Git Product home page Git Product logo

swift-concurrency's Introduction

Swift Concurrency

Build Status Carthage compatible License

Contents

Requirements

  • Xcode 9.3+
  • Swift 4.0+

Overview

A set of concurrency utility classes used by Uber. These are largely inspired by the equivalent java.util.concurrent package classes.

AtomicBool

Provides locking-free synchronization of a mutable Bool. It provides higher performance than using locks to ensure thread-safety and synchronization correctness.

AtomicInt

Provides locking-free synchronization of a mutable Int. It provides higher performance than using locks to ensure thread-safety and synchronization correctness.

AtomicReference

Provides locking-free synchronization of a mutable object reference. It provides higher performance than using locks to ensure thread-safety and synchronization correctness.

CountDownLatch

A utility class that allows coordination between threads. A count down latch starts with an initial count. Threads can then decrement the count until it reaches zero, at which point, the suspended waiting thread shall proceed. A CountDownLatch behaves differently from a DispatchSemaphore once the latch is open. Unlike a semaphore where subsequent waits would still block the caller thread, once a CountDownLatch is open, all subsequent waits can directly passthrough.

ConcurrentSequenceExecutor

An execution utility that executes sequences of tasks and returns the final result in a highly concurrent environment.

SerialSequenceExecutor

A debugging executor that executes sequences of tasks and returns the final result serially on the caller thread.

Installation

Carthage

Carthage is a decentralized dependency manager that builds your dependencies and provides you with dylib frameworks.

You can install Carthage with Homebrew using the following command:

$ brew update
$ brew install carthage

To integrate Swift-Concurrency into your Xcode project using Carthage, specify it in your Cartfile:

github "https://github.com/uber/swift-concurrency.git" ~> 0.4.0

Run carthage update to build the framework and add the built Concurrency.framework into your Xcode project, by following the instructions

Manually

If you prefer not to use Carthage, you can integrate Swift-Concurrency into your project manually, by adding the source files.

Building

First fetch the dependencies:

$ swift package fetch

You can then build from the command-line:

$ swift build

Or create an Xcode project and build using the IDE:

$ swift package generate-xcodeproj

Testing

From command-line.

$ swift test

Or you can follow the steps above to generate a Xcode project and run tests within Xcode.

Related projects

If you like Needle, check out other related open source projects from our team:

  • Needle: a compile-time safe Swift dependency injection framework.
  • Swift Abstract Class: a light-weight library along with an executable that enables compile-time safe abstract class development for Swift projects.
  • Swift Common: common libraries used by this set of Swift open source projects.

License

FOSSA Status

swift-concurrency's People

Contributors

neakor avatar sbarow avatar rudro avatar rmaz avatar mre-fog avatar fossabot avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.