Sha256: 6243768163d0d6d0fc244da2f1e9a2ad0d74599ab2a9c2414c98dcd374219892

Contents?: true

Size: 713 Bytes

Versions: 18

Compression:

Stored size: 713 Bytes

Contents

A synchronization primitive, which allows fibers to wait until a particular condition is (edge) triggered. Zero or more fibers can wait on a condition. When the condition is signalled, the fibers will be resumed in order.

## Example

~~~ ruby
require 'async'

Sync do
	condition = Async::Condition.new
	
	Async do
		Console.info "Waiting for condition..."
		value = condition.wait
		Console.info "Condition was signalled: #{value}"
	end
	
	Async do |task|
		task.sleep(1)
		Console.info "Signalling condition..."
		condition.signal("Hello World")
	end
end
~~~

### Output

~~~
0.0s     info: Waiting for condition...
1.0s     info: Signalling condition...
1.0s     info: Condition was signalled: Hello World
~~~

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
async-2.21.0 lib/async/condition.md
async-2.20.0 lib/async/condition.md
async-2.19.0 lib/async/condition.md
async-2.18.0 lib/async/condition.md
async-2.17.0 lib/async/condition.md
async-2.16.1 lib/async/condition.md
async-2.16.0 lib/async/condition.md
async-2.15.3 lib/async/condition.md
async-2.15.2 lib/async/condition.md
async-2.15.1 lib/async/condition.md
async-2.15.0 lib/async/condition.md
async-2.14.2 lib/async/condition.md
async-2.14.1 lib/async/condition.md
async-2.14.0 lib/async/condition.md
async-2.13.0 lib/async/condition.md
async-2.12.1 lib/async/condition.md
async-2.12.0 lib/async/condition.md
async-2.11.0 lib/async/condition.md