Get rid of callcc

[SeeRM 8407]
This commit is contained in:
James Lee 2013-09-23 19:36:26 -05:00
parent 973bdc3fe0
commit 487f68f4d2
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)
}
}