Module: Rubinius

Defined in:
lib/rubinius/kernel/common/env.rb,
lib/rubinius/kernel/common/type.rb,
lib/rubinius/kernel/common/tuple.rb,
lib/rubinius/kernel/common/channel.rb,
lib/rubinius/kernel/bootstrap/channel.rb

Overview

Channel is a FIFO, thread-aware value passing class that can hold any number of objects similar to Queue. Use #send to add objects to the channel and #receive to remove objects from the channel.

If Channel#receive is called on an empty channel, the VM puts the current Thread (t1) to sleep. At some future time, when Channel#send is called on that same thread, the VM wakes up t1 and the value passed to #send is returned. This allows us to implement all manner of Thread semantics, such as Mutex.

Channel is used heavily by Scheduler, to allow ruby code to interact with the outside world in a thread aware manner.

Defined Under Namespace

Modules: Type Classes: ByteArray, Channel, EnvironmentVariables, Tuple