Class: Concurrent::ThreadLocalVar
- Inherits:
-
ThreadLocalVarImplementation
- Object
- Concurrent::ThreadLocalVar
- Defined in:
- lib/concurrent/atomic/thread_local_var.rb
Overview
A ThreadLocalVar
is a variable where the value is different for each thread.
Each variable may have a default value, but when you modify the variable only
the current thread will ever see that change.
Testing with ruby 2.1.2 Testing with Concurrent::MutexAtomicBoolean... 2.790000 0.000000 2.790000 ( 2.791454) Testing with Concurrent::CAtomicBoolean... 0.740000 0.000000 0.740000 ( 0.740206)
Testing with jruby 1.9.3 Testing with Concurrent::MutexAtomicBoolean... 5.240000 2.520000 7.760000 ( 3.683000) Testing with Concurrent::JavaAtomicBoolean... 3.340000 0.010000 3.350000 ( 0.855000)
Instance Method Summary (collapse)
-
- (Object) bind(value) { ... }
Bind the given value to thread local storage during execution of the given block.
-
- (undocumented) initialize(default = nil)
constructor
Creates a thread local variable.
-
- (Object) value
Returns the value in the current thread's copy of this thread-local variable.
-
- (Object) value=(value)
Sets the current thread's copy of this thread-local variable to the specified value.
Constructor Details
- (undocumented) initialize(default = nil)
Creates a thread local variable.
102 103 |
# File 'lib/concurrent/atomic/thread_local_var.rb', line 102 class ThreadLocalVar < ThreadLocalVarImplementation end |
Instance Method Details
- (Object) bind(value) { ... }
Bind the given value to thread local storage during execution of the given block.
102 103 |
# File 'lib/concurrent/atomic/thread_local_var.rb', line 102 class ThreadLocalVar < ThreadLocalVarImplementation end |
- (Object) value
Returns the value in the current thread's copy of this thread-local variable.
102 103 |
# File 'lib/concurrent/atomic/thread_local_var.rb', line 102 class ThreadLocalVar < ThreadLocalVarImplementation end |
- (Object) value=(value)
Sets the current thread's copy of this thread-local variable to the specified value.
102 103 |
# File 'lib/concurrent/atomic/thread_local_var.rb', line 102 class ThreadLocalVar < ThreadLocalVarImplementation end |