class GLib::MainLoop::ThreadEnabler

Class encapsulationg logic for running an idle handler to make Ruby code run during GLib’s event loop.

Constants

DEFAULT_TIMEOUT
FRAMERATE

Public Class Methods

new(timeout = DEFAULT_TIMEOUT) click to toggle source
# File lib/ffi-glib/main_loop.rb, line 18
def initialize(timeout = DEFAULT_TIMEOUT)
  @timeout = timeout
end

Public Instance Methods

setup_idle_handler() click to toggle source
# File lib/ffi-glib/main_loop.rb, line 22
def setup_idle_handler
  @handler_id ||=
    GLib.timeout_add(GLib::PRIORITY_DEFAULT, @timeout, &handler_proc)
end

Private Instance Methods

handler_proc() click to toggle source
# File lib/ffi-glib/main_loop.rb, line 29
def handler_proc
  proc do
    ::Thread.pass
    true
  end
end