thread safe



Hi, I wonder if GNOME 2.0 will be thread safe...
In fact, Im coding an heavily multi threaded application, compatible
with Netmeeting,
and all gtk functions in the threads are between gdk_threads_enter
and gdk_threads_leave.
You can see some shots at http://www.gnomemeeting.org/shots

The gtk_main is not between these 2 functions, but the body of a refresh
function, called when
gnome is iddle (gtk_iddle_add), is called between these two functions.

Unfortunately, sometimes, I still get some XLIB asynchronous reply.

So, my first question is if GNOME 2.0 will be thread safe or not...
Or if you could give me more help....

// the refresh function
gint Timer ()
{

  // This is the main thread, but not the main gtk_main => threads
protection
  gdk_threads_enter ();
  while (gtk_events_pending())
    gtk_main_iteration();
  gdk_threads_leave ();

  usleep (50);
  return TRUE;
}


is the only function in the main thread with gdk_threads_enter. I can't
make without it.
If I do not use gtk_idle_add on this function, when a connection begins
in another thread, the gnome
interface seems to be frozen, it still answers to events, but it is no
more refreshed. 
If I do not put gdk_threads_enter / gdk_threads_leave, which seems
logical to me as
we are in the main thread, the interface is completely broken (same
effect as 2 gdk_threads_enter
without gdk_threads_leave in the same thread)

Is it the right way to do it ?
* I put gdk_threads* in this function
* I didn't put these around gtk_main
* I put it around all gtk_* functions called from threads.

But sometimes, I put these around blocks of gtk functions. Do I have to
put it around every single
gtk_* function or can I put these around blocks ?

Please help !!
thank you... 
Ive spent a lot of time before asking, so please help ;-))

-- 
  _
 (o-      SANDRAS Damien
 //\      Président ACM LLN
 v_/_     

Open Source and Free Software Developers Meeting
http://www.osdem.org






[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]