Sha256: 9f15c607676fe7eb0e07033a3d2b77253ff32006626b48b9fbac6107db38f8ae

Contents?: true

Size: 800 Bytes

Versions: 7

Compression:

Stored size: 800 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... [ec=0x3c] [pid=47943]
1.0s     info: Signalling condition... [ec=0x64] [pid=47943]
1.0s     info: Condition was signalled: Hello World [ec=0x3c] [pid=47943]
~~~

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
async-2.2.1 lib/async/condition.md
async-2.2.0 lib/async/condition.md
async-2.1.0 lib/async/condition.md
async-2.0.3 lib/async/condition.md
async-2.0.2 lib/async/condition.md
async-2.0.1 lib/async/condition.md
async-2.0.0 lib/async/condition.md