class ConditionVariable
class Timeout < Exception; end
# Create a new timer with the argument timeout, and add the
# current thread to the list of waiters. Then the thread is
# stopped. It will be resumed when a corresponding #signal
# occurs.
def wait(timeout = nil)
@monitor.instance_eval {mon_check_owner()}
timer = create_timer(timeout)
Thread.critical = true
count = @monitor.instance_eval {mon_exit_for_cond()}
@waiters.push(Thread.current)
begin
Thread.stop
return true
rescue Timeout
return false
ensure
Thread.critical = true
begin
...
--
Love,
Fritz
No comments:
Post a Comment