Module: Libuv::Accessors

Included in:
Libuv, Reactor
Defined in:
lib/libuv/mixins/accessors.rb

Constant Summary collapse

Functions =
[
    :defer, :all, :any, :finally, :update_time, :now, :lookup_error, :tcp,
    :udp, :tty, :pipe, :timer, :prepare, :check, :idle, :async, :signal,
    :work, :lookup, :fs_event, :file, :filesystem, :schedule, :next_tick,
    :stop, :reactor_thread?, :reactor_running?, :run
].freeze

Instance Method Summary collapse

Instance Method Details

#reactorObject



5
6
7
8
9
10
11
12
13
14
15
# File 'lib/libuv/mixins/accessors.rb', line 5

def reactor
    thread = Libuv::Reactor.current
    if thread.nil?
        thread = Libuv::Reactor.default
        if thread.reactor_running?
            raise 'No reactor available on this thread'
        end
    end
    thread.run { yield(thread) } if block_given?
    thread
end