Context: on Linux/Debian/Sid x86-64 for my bismon (GPLv3+) software (described here)
(GTK 3.24, Glib 2.62, Xorg server, function register_gui_postponed_BM
, file gui_GTKBM.c
)
Can g_timeout_add
be safely called from some other thread than the main thread? I can easily ensure that call would be serialized (using a pthread mutex) but I cannot guarantee it would be called from the main thread. The threads are Pthreads, not Glib threads.
I found both this and that, and they make me think it is indeed safe.... But I might have understood wrongly.
Yes. It boils down to a call to g_source_attach()
, which locks the GMainContext
it adds the timeout source to.