lib/murasaki/event_loop.rb in murasaki-0.1.0 vs lib/murasaki/event_loop.rb in murasaki-0.2.0
- old
+ new
@@ -11,10 +11,12 @@
@timers = []
# Hash of io and its callback
@ios = Hash.new
# IO queue
@queue = Hash.new
+ # Root fiber
+ @root_fiber = Fiber.current
end
# Add timer in event loop
# @param [EventLoop::Timer] timer timer to insert
# @return [nil] nil
@@ -111,8 +113,13 @@
# Detect the stop flag
# @return [Boolean] return if eventloop is set to be stopped
def running?
@stop = true if @stop.nil?
!@stop
+ end
+
+ def root_fiber
+ config if @selector.nil?
+ @root_fiber
end
end
end