Class: Thread

Inherits:
Object
  • Object
show all
Defined in:
lib/thread.rb

Class Method Summary collapse

Class Method Details

.exclusive { ... } ⇒ Object

Wraps a block in Thread.critical, restoring the original value upon exit from the critical section, and returns the value of the block.

Yields:

Returns:

  • (Object)


24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/thread.rb', line 24

/*
 *  call-seq:
 *     Thread.exclusive { block }   => obj
 *  
 *  Wraps a block in Thread.critical, restoring the original value
 *  upon exit from the critical section, and returns the value of the
 *  block.
 */

static VALUE
rb_thread_exclusive(void)
{
    return thread_exclusive(rb_yield, Qundef);
}