class Concurrent::MutexAtomicBoolean
@see docs.oracle.com/javase/7/docs/api/java/util/concurrent/atomic/AtomicBoolean.html java.util.concurrent.atomic.AtomicBoolean
@since 0.6.0
briefly but no explicit locking is required.
boolean and thread-safe and guaranteed to succeed. Reads and writes may block
A boolean value that can be updated atomically. Reads and writes to an atomic
@!macro [attach] atomic_boolean
def false?
-
(Boolean)- true if the current value is `false`, else false
def false? @mutex.lock result = !@value @mutex.unlock result end
def initialize(initial = false)
-
init(Boolean) -- the initial value
def initialize(initial = false) @value = !!initial @mutex = Mutex.new end
def make_false
-
(Boolean)- true is value has changed, otherwise false
def make_false @mutex.lock old = @value @value = false @mutex.unlock old end
def make_true
-
(Boolean)- true is value has changed, otherwise false
def make_true @mutex.lock old = @value @value = true @mutex.unlock !old end
def true?
-
(Boolean)- true if the current value is `true`, else false
def true? @mutex.lock result = @value @mutex.unlock result end
def value
-
(Boolean)- the current value
def value @mutex.lock result = @value @mutex.unlock result end
def value=(value)
-
(Boolean)- the current value
Parameters:
-
value(Boolean) -- the new value to be set
def value=(value) @mutex.lock @value = !!value result = @value @mutex.unlock result end