Re: Multi-thread problem





2008/9/23 Chris Moller <moller mollerware com> sais:

Accordingly, my GTK wrapper uses two threads, one that responds to user
interaction to pipe things to the utility, another that loops on a
blocking read of a pipe from the utility...

Sorry, the fact that you are reading and writing asynchronously does not mean that you need two threads. You may instead use gtk_input_add() to add a callback when there is something to read on stdin.

If you really need to use 2 threads, then only one of them (the one you called gtk_main from) should call any gtk/gdk command. The second thread may, as Anthony wrote, pass info to the first thread through g_idle_add.

Regards,
Dov




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