Re: newby stupid syncronization question...




DROUIN Antoine STNA 7SB K232 p5766 <drouin@stna.dgac.fr> writes:

> hello
> 
> I'm writing a gui that must wait for async messages in a blocking function.
> So i've created a second thread. When i get a message in the second thread, i 
> would like to notify the first thread thats sleeps in gtk-main and pass it the 
> message, in order to avoid having two threads using gtk.
> What is the best way of doing that ?

 [ before you do anything  with glib ]

 g_thread_init()

 [in subsidiary thread ]

 g_idle_add (some_function_to_call, some_data_to_pass);

[ You could also use the standard GTK+ locking mechanisms 
  and then go ahead and make GTK+ calls from the main
  thread ]

Regards,
                                        Owen



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