Module: MultiProcessing

Defined in:
lib/multiprocessing.rb,
lib/multiprocessing/mutex.rb,
lib/multiprocessing/queue.rb,
lib/multiprocessing/version.rb,
lib/multiprocessing/semaphore.rb,
lib/multiprocessing/processerror.rb,
lib/multiprocessing/externalobject.rb,
lib/multiprocessing/conditionvariable.rb

Overview

MultiProcessing provides classes for inter-process synchronization and communication in Ruby.

These classes can be used like ones in Ruby standard library for multi threading.

To realize communitation across processes, MultiProcessing uses pipe (IO.pipe). You have to use fork to create multiple processes which accesses synchronizing/communication object. For this reason, MultiProcessing can be used only on Unix or Linux.

Defined Under Namespace

Classes: ConditionVariable, ExternalObject, Mutex, ProcessError, Queue, QueueError, Semaphore

Constant Summary collapse

VERSION =

A version of MultiProcessing library

0.0.1 (2012-02-13) : Initial release

0.0.2 (2012-07-14) : fixed many bugs

"0.0.2"

Class Method Summary collapse

Class Method Details

.try_handle_interrupt(*args) ⇒ Object

If Thread has handle_interrupt (Ruby 2.0.0 or later), call it with given arguments and block. If not, simply yield passed block

Parameters:

  • args (Array<Object>)

    arguments to give Thread.handle_interrupt

Returns:

  • (Object)

    returned value of the block



34
35
36
# File 'lib/multiprocessing.rb', line 34

def try_handle_interrupt *args, &block
  Thread.handle_interrupt *args, &block
end