Re: Text box problems
- From: Jonathan Irwin <jmi25 cam ac uk>
- To: Chris Nuernberger <nuernber colorado edu>
- Cc: gtk-app-list <gtk-app-devel-list gnome org>
- Subject: Re: Text box problems
- Date: Sat, 13 Jan 2001 11:12:34 +0000 (GMT)
On 12 Jan 2001, Chris Nuernberger wrote:
Ok here is the problem, you were right to suggest it is with threads. I follow
the faq regarding threads, and all it mentions are three functions,
g_thread_init, gdk_thread_[enter/leave]. Using these functions makes no
difference, here is the program if
you want to see for yourself.
<code snipped>
You need to gdk_threads_enter() before you use any GTK or GDK functions in
a thread as well, so your function make_textbox() needs to start with
gdk_threads_enter() and end with gdk_threads_leave() [these functions
control a global mutex which ensures only one process calls Xlib or
modifies any global data for GTK/GDK simeltaneously]. Currently you are
doing main() correctly, but when the thread function make_textbox() gets
called, the gtk_main() loop is still running because you haven't locked
the mutex [hence it tries to access Xlib at the same time as your thread,
giving the error].
Hope this helps
Jonathan
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]