Modern concurrency tools including agents, futures, promises, thread pools, supervisors, and more. Inspired by Erlang, Clojure, Scala, Go, Java, JavaScript, and classic concurrency patterns.
Thread#kill
on it.Using https://travis-ci.org/ruby-concurrency/concurrent-ruby/jobs/659471195
Rubinius
osx, Xcode: xcode8 Ruby: rbx-3.107
Hey. I have a Javascript Promise/A+ background. Trying to understand the API reference, cause it's hard to find any examples for the library usage in the Net.
The question is how to create a pending Promise?
I use multiple constructor functions like: Concurrent::Promises.future
and Concurrent::Promises.zip_futures
(aka Promise.all) and both start to invoke resolver immediately.
I want to be able to resolve explicitly with the wait
/result
/value
method.
Instead, now I need to add an unneeded condition like this:result.wait unless result.fulfilled?
Thanks.
@Hyperc0der_twitter here's a GitHub search that has plenty of code examples:
I do though think most usages are executing the promise and resolving.
Channel.go
Concurrent::Channel.go do
loop do
Concurrent::Channel.select do |s|
s.take(somechannel) {
#do something
}
s.take(otherchannel) {
# dosomething
}
end
end
end