Defer kernel_sleep
to block
to avoid exiting the event loop when duration is nil.
This commit is contained in:
parent
c39984ec5c
commit
57b83dad4c
Notes:
git
2020-11-08 16:41:18 +09:00
@ -135,12 +135,7 @@ class Scheduler
|
|||||||
|
|
||||||
# Used for Kernel#sleep and Mutex#sleep
|
# Used for Kernel#sleep and Mutex#sleep
|
||||||
def kernel_sleep(duration = nil)
|
def kernel_sleep(duration = nil)
|
||||||
# p [__method__, duration]
|
self.block(:sleep, duration)
|
||||||
if duration
|
|
||||||
@waiting[Fiber.current] = current_time + duration
|
|
||||||
end
|
|
||||||
|
|
||||||
Fiber.yield
|
|
||||||
|
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user