swift-concurrency-primitives

main

Low-level concurrency primitives for Swift
Genaro-Chris/swift-concurrency-primitives

swift-concurrency-primitives

License

A concurrency primitive package written in swift for swift developers

Overview

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.

Installation

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")

Features

This package provides various basic concurrency primitives which can be categorized into the following

Synchronization

This package also provides some constructs that synchronize concurrent accesses to a critical code section in order to avoid data race bugs

Threads Co-ordination

This package even provide some constructs for co-ordination for threads by waiting for all threads to finish their execution

Message Passing

This package provides some concurrency constructs that enable threads share memory by communicating values as message.

ThreadPool

This package provides some concurrency construct that efficiently manage a fized size of worker threads ready to execute code.

Call Once

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

Documentation

The full API documentation can be accessed here

ExampleUsage

For some practical usage for this package, take a good look at ExampleApp

Contributing

I highly welcome and encourage all sorts of contributions from all developers.

License

This package is released under Apache-2.0 license. See LICENSE for more information.

Description

  • Swift Tools 5.8.0
View More Packages from this Author

Dependencies

Last updated: Wed Apr 17 2024 00:07:19 GMT-0900 (Hawaii-Aleutian Daylight Time)