lib/lightio/core/beam.rb in lightio-0.3.1 vs lib/lightio/core/beam.rb in lightio-0.3.2
- old
+ new
@@ -47,11 +47,11 @@
def initialize(*args, &blk)
raise Error, "must be called with a block" unless blk
super() {
begin
@value = yield(*args)
- rescue StandardError => e
+ rescue Exception => e
@error = e
end
# mark as dead
dead
# transfer back to parent(caller fiber) after schedule
@@ -134,11 +134,14 @@
#
# normally beam should be auto scheduled, use this method to manually trigger a schedule
#
# @return [nil]
def pass
+ running = IOloop.current.running
schedule = LightIO::Watchers::Schedule.new
IOloop.current.wait(schedule)
+ # make sure ioloop run once
+ pass unless running
end
end
private