项目作者: std-swift

项目描述 :
Locks and Atomic
高级语言: Swift
项目地址: git://github.com/std-swift/Atomic.git
创建时间: 2019-02-19T16:46:06Z
项目社区:https://github.com/std-swift/Atomic

开源协议:GNU Lesser General Public License v3.0

下载


Atomic





Provides locks and Atomic<T>

Importing

  1. import Atomic
  1. platforms: [
  2. .macOS(.v10_12)
  3. ],
  4. dependencies: [
  5. .package(url: "https://github.com/std-swift/Atomic.git",
  6. from: "1.0.0")
  7. ],
  8. targets: [
  9. .target(
  10. name: "",
  11. dependencies: [
  12. "Atomic"
  13. ]),
  14. ]

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