A concurrency primitive package written in swift for swift developers
This package provides various basic concurrency primitives such as Lock
, Locked
which is similar to Mutex
in other languages, ThreadPool
, Channel
and Queue
.
This package aims to provide concurrency primitives that are readily available in other programming languages but not in swift.
To use this package
First, add the following package dependency to your package.swift
file
.package(url: "https://github.com/Genaro-Chris/swift-concurrency-primitives", branch: "main")
Then add the Primitives
library to the target(s) you want to use it
.product(name: "Primitives", package: "swift-concurrency-primitives")
This package provides various basic concurrency primitives which can be categorized into the following
This package also provides some constructs that synchronize concurrent accesses to a critical code section in order to avoid data race bugs
This package even provide some constructs for co-ordination for threads by waiting for all threads to finish their execution
This package provides some concurrency constructs that enable threads share memory by communicating values as message.
This package provides some concurrency construct that efficiently manage a fized size of worker threads ready to execute code.
A synchronization primitive which provides a way of executing code exactly once regardless of how many times it was called in a thread-safe manner
And many more others
The full API documentation can be accessed here
For some practical usage for this package, take a good look at ExampleApp
I highly welcome and encourage all sorts of contributions from all developers.
This package is released under Apache-2.0 license. See LICENSE for more information.