Class: FinishLine
Overview
easy thread-safe class for determining who’s the “winner” in a race (i.e. first person to hit the finish line
Instance Method Summary collapse
-
#initialize ⇒ FinishLine
constructor
A new instance of FinishLine.
- #winner? ⇒ Boolean
Constructor Details
#initialize ⇒ FinishLine
Returns a new instance of FinishLine.
738 739 740 741 |
# File 'lib/sup/util.rb', line 738 def initialize @m = Mutex.new @over = false end |
Instance Method Details
#winner? ⇒ Boolean
743 744 745 |
# File 'lib/sup/util.rb', line 743 def winner? @m.synchronize { !@over && @over = true } end |