Calling gtk code from two different threads



I have a problem where I have to call gtk code, including two gtk_main's, from two different threads and was wondering if there's any way to do that _without_ calling gdk_thread_enter/gdk_thread_
leave.

I'm writing a debugger for an interpreted language, using a gtk gui. The debugger works as a loadable module for the interpreter, so it runs in the same process as the interpreter, but in it's own thread. gtk_main is called in that thread. g_threads_init and gdk_threads_init are called before gtk_main and all gtk code that can be called from any other thread within the debugger is protected by gdk_thread_enter/gdk_thread_leave.

The problem is that the debugged program may also call gtk code. Obviously, I can't modify the debugged program to check for the debugger before calling gtk code. On the other hand, the debugger can't know in advance whether the debugged program will call gtk code or not either. Hence the problem.

I'm thinking of splitting the debugger code into gtk and non-gtk code with the gtk code running in a separate process and using pipes for communication, but thought I'd ask if there was any way to avoid that.



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