Sha256: 28105a7dba7523bb6407d9a1f8e620e641ac399f320299b18655ee05d2c97f93

Contents?: true

Size: 734 Bytes

Versions: 21

Compression:

Stored size: 734 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.logger.info "Waiting for condition..."
		value = condition.wait
		Console.logger.info "Condition was signalled: #{value}"
	end
	
	Async do |task|
		task.sleep(1)
		Console.logger.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

21 entries across 21 versions & 1 rubygems

Version Path
async-2.10.2 lib/async/condition.md
async-2.10.1 lib/async/condition.md
async-2.10.0 lib/async/condition.md
async-2.9.0 lib/async/condition.md
async-2.8.2 lib/async/condition.md
async-2.8.1 lib/async/condition.md
async-2.8.0 lib/async/condition.md
async-2.7.0 lib/async/condition.md
async-2.6.5 lib/async/condition.md
async-2.6.4 lib/async/condition.md
async-2.6.3 lib/async/condition.md
async-2.6.2 lib/async/condition.md
async-2.6.1 lib/async/condition.md
async-2.6.0 lib/async/condition.md
async-2.5.1 lib/async/condition.md
async-2.5.0 lib/async/condition.md
async-2.4.2 lib/async/condition.md
async-2.4.1 lib/async/condition.md
async-2.4.0 lib/async/condition.md
async-2.3.1 lib/async/condition.md