Class: Thread
Defined Under Namespace
Classes: Queue
Class Method Summary collapse
Instance Method Summary collapse
-
#[](key) ⇒ Object
fiber-local attribute access.
- #[]=(key, value) ⇒ Object
-
#initialize(*args) ⇒ Thread
constructor
Do not allow creation of new instances.
- #key?(key) ⇒ Boolean
- #keys ⇒ Object
- #thread_variable?(key) ⇒ Boolean
-
#thread_variable_get(key) ⇒ Object
thread-local attribute access.
- #thread_variable_set(key, value) ⇒ Object
- #thread_variables ⇒ Object
Constructor Details
#initialize(*args) ⇒ Thread
Do not allow creation of new instances.
23 24 25 |
# File 'opal/stdlib/thread.rb', line 23 def initialize(*args) fail NotImplementedError, "Thread creation not available" end |
Class Method Details
.current ⇒ Object
9 10 11 12 13 14 15 16 |
# File 'opal/stdlib/thread.rb', line 9 def self.current unless @current @current = allocate @current.core_initialize! end @current end |
.list ⇒ Object
18 19 20 |
# File 'opal/stdlib/thread.rb', line 18 def self.list [current] end |
Instance Method Details
#[](key) ⇒ Object
fiber-local attribute access.
28 29 30 |
# File 'opal/stdlib/thread.rb', line 28 def [](key) @fiber_locals[coerce_key_name(key)] end |
#[]=(key, value) ⇒ Object
32 33 34 |
# File 'opal/stdlib/thread.rb', line 32 def []=(key, value) @fiber_locals[coerce_key_name(key)] = value end |
#key?(key) ⇒ Boolean
36 37 38 |
# File 'opal/stdlib/thread.rb', line 36 def key?(key) @fiber_locals.key?(coerce_key_name(key)) end |
#keys ⇒ Object
40 41 42 |
# File 'opal/stdlib/thread.rb', line 40 def keys @fiber_locals.keys end |
#thread_variable?(key) ⇒ Boolean
53 54 55 |
# File 'opal/stdlib/thread.rb', line 53 def thread_variable?(key) @thread_locals.key?(coerce_key_name(key)) end |
#thread_variable_get(key) ⇒ Object
thread-local attribute access.
45 46 47 |
# File 'opal/stdlib/thread.rb', line 45 def thread_variable_get(key) @thread_locals[coerce_key_name(key)] end |
#thread_variable_set(key, value) ⇒ Object
49 50 51 |
# File 'opal/stdlib/thread.rb', line 49 def thread_variable_set(key, value) @thread_locals[coerce_key_name(key)] = value end |
#thread_variables ⇒ Object
57 58 59 |
# File 'opal/stdlib/thread.rb', line 57 def thread_variables @thread_locals.keys end |