Land #2413, axe callcc

This is the only time callcc is used in the entire codebase, too, so
this apparently removes a roadblack to non-MRI Rubies, so that's nice.
bug/bundler_fix
Tod Beardsley 2013-10-10 14:55:55 -05:00
commit 85112e8704
No known key found for this signature in database
GPG Key ID: 1EFFB682ADB9F193
1 changed files with 4 additions and 14 deletions

View File

@ -61,22 +61,12 @@ class Event
# Waits for the event to become signaled. Timeout is measured in
# seconds. Raises TimeoutError if the condition does not become signaled.
#
begin
# XXX: we need to replace this code
# continuations slow down YARV
require "continuation" if not defined? callcc
rescue ::LoadError
end
def wait(t = Infinite)
callcc { |ctx|
self.mutex.synchronize {
ctx.call if (self.state == true)
self.mutex.synchronize {
break if (self.state == true)
Timeout.timeout(t) {
self.cond.wait(self.mutex)
}
Timeout.timeout(t) {
self.cond.wait(self.mutex)
}
}