Name
Thread — Thread class
Synopsis
The class for user-level threads. When the main thread terminates, the other threads are killed, and the interpreter quits.
Class Methods
Thread::abort_on_exception
Returns
true
if thread is set to abort on an exception.Thread::abort_on_exception=
bool
Sets whether or not to abort on an exception. When aborting on an exception, displays an error message for exceptions raised in the thread and quits the program.
Thread::critical
Returns
true
when scheduling of existing threads is prohibited.Thread::critical=
bool
Sets the status of thread-scheduling prohibition.
Thread::current
Returns the current thread.
Thread::exit
Terminates the current thread.
Thread::fork([
arg...
]) {|
x...
|
...
}
See
Thread::start([
arg...
]) {|
x...
|
...
}
.Thread::kill(
th
)
Terminates the specified thread.
Thread::list
Returns an array of all threads.
Thread::main
Returns the main thread.
Thread::new([
arg...
]) {|
x...
|
...
}
See
Thread::start([
arg...
]) {|
x...
|
...
}
.Thread::pass
Passes execution to another thread.
Thread::start([
arg...
]) {|
x...
|
...
}
Thread::fork([
arg...
]) {|
x...
|
...
}
Thread::new([
arg...
]) {|
x...
|
...
}
Creates a new thread and executes the block in it. Arguments are passed directly to the block.
Thread::stop
Stops the current thread.
Instance Methods
t
[
name
]
Retrieves the value of a thread-local variable associated with
name
. Thename
is either a string or a symbol.t
[
name
]=
value
Sets the
value
of a thread-local variable.t
.abort_on_exception
Returns
true
if thread is set to abort on an exception. ...
Get Ruby in a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.