Re: [maemo-developers] Glib main loop behavior

2005-12-07 Thread Samuel Abels
On Mi, 2005-12-07 at 14:16 +0100, Martin Grimme wrote:
> Am Dienstag, den 06.12.2005, 18:36 +0100 schrieb Samuel Abels:
> > 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.
> 
> You have to call g_thread_init at the beginning

Ouch, I should have known. Thanks for your help, of course it works.

-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


[maemo-developers] Glib main loop behavior

2005-12-06 Thread Samuel Abels
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