[gtk-list] using pthread and gtktext widget



Hi,

I'm developing a multi-threaded simulation application on Solaris
2.5.1 (with X11R5), the main thread basically just run gtk_main and
the other thread get commands from the  main thread and runs some time
consuming job and output some text. (both threads run in parallel all
the time). Here's what it looks like: 

.
.
.
g_thread_init(NULL);
.
.
pthread_create(&simulationthread, simulationroutine, ....);

.
gtk_main();
.


in the simulation routine, whenever gtk_text_insert is called, I put a 
GDK_THREAD_ENTER() and GDK_THREAD_LEAVE around it. However, the
application hangs in gtk_text_insert (which calls poll). Here's the
traceback: 

   gtk_text_insert(0x5d9d68, 0xd, 0x0, 0xeee0ae88, 0x2c, 0x2c)
   insert_expose(0x5d9d68, 0x9c, 0x34, 0x4, 0xd, 0x2c)
   process_exposes(0x5d9d68, 0x5e57a0, 0x0, 0xce, 0x0, 0xc3)
   gdk_event_get_graphics_expose(0x5e6bd0, 0x7400045, 0x5e7c20, 0x0,
 0xce, 0x0)
   XIfEvent(0x5bae98, 0xeee0abb8, 0x2f8020, 0x5e6bd0, 0x6243b8, 0x0)
   _XReadEvents(0x5bae98, 0x0, 0x5baf2c, 0x5bb35c, 0x20, 0x5be9a0)
   _XRead(0x5bae98, 0x5be9a0, 0x20, 0x5baea0, 0x20, 0xffffffff)
   _XWaitForReadable(0x5bae98, 0x5bb35c, 0x5bb368, 0xeee0aa08, 0x0, 0x4)
   _select(0x5, 0xeee0aa0c, 0x1, 0x1, 0xffffffff, 0xeee089b0)
   poll(0xeee089a8, 0x1, 0xffffffff, 0xffffe000, 0x10, 0x0)


Any idea?  Or I have to set up a pipe between the two threads and have 
the main thread calls all the GUI function like gtk_text_insert. :-(

Thank you.

Adrian



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