Hello,

I am trying to hook a callback into the glib mainloop using g_idle_add()
and have noticed that the behaviour appears to differ from (what I
believe is) the way Gtk does this outside of Maemo. For example, in the
following code:

-------------------------
gboolean my_callback_in_the_glib_loop(gpointer data)
{
  g_print("Joe was here\n");
  return FALSE;
}

gpointer my_thread(gpointer data)
{
  while (running) {
    g_idle_add(my_callback_in_the_glib_loop, NULL);
    do_something();
  }
  return NULL;
}

void on_button_pressed(...) {
  ...
  g_thread_create(my_thread, NULL, FALSE, NULL);
}
-------------------------

The problem is that my_callback_in_the_glib_loop() is only called when
there is activity on the screen, such as the mouse pointer moving over
the Xephyr window in the scratchbox environment.

What is the reason for this behaviour, and is there a way around it? I
would like to use the mechanism to work around Gtk not being thread
safe.

-Samuel
-- 
 ------------------------------------------------------
|      Samuel Abels       |   http://www.debain.org    |
| spam2 ad debain dod org | knipknap ad jabber dod org |
 ------------------------------------------------------
_______________________________________________
maemo-developers mailing list
maemo-developers@maemo.org
https://maemo.org/mailman/listinfo/maemo-developers

Reply via email to