Method: Concurrent::MVar#try_take!
- Defined in:
- lib/concurrent-ruby/concurrent/mvar.rb
#try_take! ⇒ Object
Non-blocking version of ‘take`, that returns `EMPTY` instead of blocking.
142 143 144 145 146 147 148 149 150 151 152 153 |
# File 'lib/concurrent-ruby/concurrent/mvar.rb', line 142 def try_take! @mutex.synchronize do if unlocked_full? value = @value @value = EMPTY @empty_condition.signal (value) else EMPTY end end end |