Class: ConvenientService::Support::ThreadSafeCounter Private

Inherits:
Support::Counter
  • Object
show all
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.

Since:

  • 1.0.0

Instance Method Summary collapse

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.

Since:

  • 1.0.0



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.

See Also:

Since:

  • 1.0.0



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.

See Also:

Since:

  • 1.0.0



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.

See Also:

Since:

  • 1.0.0



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.

See Also:

Since:

  • 1.0.0



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.

See Also:

Since:

  • 1.0.0



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.

See Also:

Since:

  • 1.0.0



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.

See Also:

Since:

  • 1.0.0



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.

See Also:

Since:

  • 1.0.0



129
130
131
# File 'lib/convenient_service/support/thread_safe_counter.rb', line 129

def reset(...)
  @lock.synchronize { super }
end