开源软件名称(OpenSource Name):Zewo/Venice开源软件地址(OpenSource Url):https://github.com/Zewo/Venice开源编程语言(OpenSource Language):Swift 100.0%开源软件介绍(OpenSource Introduction):VeniceVenice provides structured concurrency and CSP for Swift. Features
Venice wraps a fork of the C library libdill. InstallationBefore using Venice you need to install our libdill fork. Follow the instruction for your operating system. macOSOn macOS install libdill using brew. brew install zewo/tap/libdill LinuxOn Linux we have to add our apt source first. You only need to run this command once in a lifetime. You don't need to run it again if you already have. echo "deb [trusted=yes] http://apt.zewo.io ./" | sudo tee -a /etc/apt/sources.list
sudo apt-get update Now just install the libdill apt package. sudo apt-get install libdill Add Venice to Package.swiftAfter installing libdill just add import PackageDescription
let package = Package(
dependencies: [
.Package(url: "https://github.com/Zewo/Venice.git", majorVersion: 0, minor: 19)
]
) Test CoverageThe inner-most circle is the entire project, moving away from the center are folders then, finally, a single file. The size and color of each slice is represented by the number of statements and the coverage, respectively. DocumentationYou can check the Venice API reference for more in-depth documentation. Structured ConcurrencyStructured concurrency means that lifetimes of concurrent functions are cleanly nested. If coroutine This is not structured concurrency: This is structured concurrency: The goal of structured concurrency is to guarantee encapsulation. If the What you end up with is a tree of coroutines rooted in the Venice implements structured concurrency by allowing you to cancel a running coroutine. let coroutine = try Coroutine {
let resource = malloc(1000)
defer {
free(resource)
}
while true {
try Coroutine.wakeUp(100.milliseconds.fromNow())
print(".")
}
}
try Coroutine.wakeUp(1.second.fromNow())
coroutine.cancel() When a coroutine is being canceled all coroutine-blocking calls will start to throw In the example above, when ThreadsYou can use Venice in multi-threaded programs. However, individual threads are strictly separated. You may think of each thread as a separate process. In particular, a coroutine created in a thread will be executed in that same thread, and it will never migrate to a different one. In a similar manner, a handle, such as a channel or a coroutine handle, created in one thread cannot be used in a different thread. LicenseThis project is released under the MIT license. See LICENSE for details. |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论