Class: ConvenientService::Support::ThreadSafeCounter Private
- Defined in:
- lib/convenient_service/support/thread_safe_counter.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Instance Attribute Summary
Attributes inherited from Counter
#current_value, #initial_value, #max_value, #min_value
Instance Method Summary collapse
-
#bdecrement ⇒ Object
private
bdecrementmeans boolean decrement. -
#bincrement ⇒ Object
private
bincrementmeans boolean increment. - #current_value= ⇒ Object private
- #decrement ⇒ Object private
- #decrement! ⇒ Object private
- #increment ⇒ Object private
- #increment! ⇒ Object private
- #initialize ⇒ void constructor private
- #reset ⇒ Object private
Constructor Details
#initialize ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
20 21 22 23 24 |
# File 'lib/convenient_service/support/thread_safe_counter.rb', line 20 def initialize(...) super @lock = ::Mutex.new end |
Instance Method Details
#bdecrement ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
bdecrement means boolean decrement. Works exactly in the same way as decrement except returns a boolean value.
If decremented successfully then returns true, otherwise - returns false.
119 120 121 |
# File 'lib/convenient_service/support/thread_safe_counter.rb', line 119 def bdecrement(...) @lock.synchronize { super } end |
#bincrement ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
bincrement means boolean increment. Works exactly in the same way as increment except returns a boolean value.
If incremented successfully then returns true, otherwise - returns false.
77 78 79 |
# File 'lib/convenient_service/support/thread_safe_counter.rb', line 77 def bincrement(...) @lock.synchronize { super } end |
#current_value= ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
35 36 37 |
# File 'lib/convenient_service/support/thread_safe_counter.rb', line 35 def current_value=(...) @lock.synchronize { super } end |
#decrement ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
90 91 92 |
# File 'lib/convenient_service/support/thread_safe_counter.rb', line 90 def decrement(...) @lock.synchronize { super } end |
#decrement! ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
103 104 105 |
# File 'lib/convenient_service/support/thread_safe_counter.rb', line 103 def decrement!(...) @lock.synchronize { super } end |
#increment ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
48 49 50 |
# File 'lib/convenient_service/support/thread_safe_counter.rb', line 48 def increment(...) @lock.synchronize { super } end |
#increment! ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
61 62 63 |
# File 'lib/convenient_service/support/thread_safe_counter.rb', line 61 def increment!(...) @lock.synchronize { super } end |
#reset ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
129 130 131 |
# File 'lib/convenient_service/support/thread_safe_counter.rb', line 129 def reset(...) @lock.synchronize { super } end |