4
-- Demonstrate how to manually run the main loop
8
-- gnome.set_debug_flags("memory", "trace")
14
ctx = glib.main_context_default()
15
ok = glib.main_context_acquire(ctx)
19
local pfd = glib.new_array("PollFD", cnt)
20
local n, timeout = glib.main_context_query(ctx, 1000, 0, pfd, cnt)
21
glib.main_context_release(ctx)
23
print("timeout is", timeout)
25
print(string.format("File descriptor #%d is %d", i, pfd[i].fd))
30
-- add another file descriptor, so that the _query function will return
31
-- more than one, just to demonstrate the array-of-objects feature.
32
function add_a_source()
33
local ctx = glib.main_context_default()
34
local pfd = glib.new "PollFD"
37
glib.main_context_add_poll(ctx, pfd, 10)