Class: Celluloid::Internals::Signals

### Home Classes Methods

### In Files

- lib/celluloid/internals/signals.rb

### Parent

Object

### Methods

- ::new
- #broadcast
- #wait

### Class/Module Index

Quicksearch

- Celluloid
- Celluloid::Incident
- Celluloid::IncidentLogger
- Celluloid::IncidentLogger::Severity
- Celluloid::IncidentReporter
- Celluloid::IncidentReporter::Formatter
- Celluloid::Internals
- Celluloid::Internals::CPUCounter
- Celluloid::Internals::CallChain
- Celluloid::Internals::Handler
- Celluloid::Internals::Handlers
- Celluloid::Internals::Links
- Celluloid::Internals::Logger
- Celluloid::Internals::Logger::WithBacktrace
- Celluloid::Internals::Method
- Celluloid::Internals::Properties
- Celluloid::Internals::Receiver
- Celluloid::Internals::Receivers
- Celluloid::Internals::Registry
- Celluloid::Internals::Response
- Celluloid::Internals::Response::Block
- Celluloid::Internals::Response::Error
- Celluloid::Internals::Response::Success
- Celluloid::Internals::Signals
- Celluloid::Internals::Stack
- Celluloid::Internals::Stack::ActorState
- Celluloid::Internals::Stack::CellState
- Celluloid::Internals::Stack::DisplayBacktrace
- Celluloid::Internals::Stack::Dump
- Celluloid::Internals::Stack::Summary
- Celluloid::Internals::Stack::TaskState
- Celluloid::Internals::Stack::ThreadState
- Celluloid::Internals::TaskSet
- Celluloid::Internals::ThreadHandle
- Celluloid::Internals::UUID
- Celluloid::LogEvent
- Celluloid::Notifications
- Celluloid::Notifications::Fanout
- Celluloid::Notifications::Subscriber
- Celluloid::Probe
- Celluloid::RingBuffer

No matching classes.

# Celluloid::Internals::Signals

Event signaling between methods of the same object

### Public Class Methods

new() click to toggle source

    # File lib/celluloid/internals/signals.rb, line 5
    def initialize
      @conditions = {}
    end

### Public Instance Methods

broadcast(name, value = nil) click to toggle source

Send a signal to all method calls waiting for the given name

    # File lib/celluloid/internals/signals.rb, line 18
    def broadcast(name, value = nil)
      condition = @conditions.delete(name)
      condition.broadcast(value) if condition
    end

wait(name) click to toggle source

Wait for the given signal and return the associated value

    # File lib/celluloid/internals/signals.rb, line 10
    def wait(name)
      fail "cannot wait for signals while exclusive" if Celluloid.exclusive?

      @conditions[name] ||= Condition.new
      @conditions[name].wait
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.