Swiftpack.co - std-swift/Atomic as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by std-swift.
std-swift/Atomic 1.0.0
Locks and Atomic<T>
⭐️ 1
🕓 4 years ago
macOS
.package(url: "https://github.com/std-swift/Atomic.git", from: "1.0.0")

Atomic

Provides locks and Atomic<T>

Importing

import Atomic
platforms: [
	.macOS(.v10_12)
],
dependencies: [
	.package(url: "https://github.com/std-swift/Atomic.git",
	         from: "1.0.0")
],
targets: [
	.target(
		name: "",
		dependencies: [
			"Atomic"
		]),
]

Using

Lockable

Provides functions to perform on locks (lock, unlock, with)

Semaphore and RwLock implement Lockable

Atomic<T>

Controlls access to a value using a lock. &= can be used as shorthand for get and set.

Atomic<Bool> has .toggle()

Atomic<T: SignedInteger> has .negate()

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics