RE: Problem with threads in my GTK+ application...
- From: "Dutta, Seemanta" <seemanta qualcomm com>
- To: <gtk-app-devel-list gnome org>
- Subject: RE: Problem with threads in my GTK+ application...
- Date: Fri, 11 Jul 2008 14:13:04 +0530
I finally found out the solution to my problme and that too without
In my burn code, after sending each byte, I am using:
while (gtk_events_pending ())
This seems to have solved my problem. Even my progress bar gets updated
But I would still like to know how to do this using threading.
top/gtk-thread-awareness.html hoping it would solve my problem but even
that did not work :-(
From: gtk-app-devel-list-bounces gnome org
[mailto:gtk-app-devel-list-bounces gnome org] On Behalf Of Andreas
Sent: Friday, July 11, 2008 12:19 PM
To: gtk-app-devel-list gnome org
Subject: Re: Problem with threads in my GTK+ application...
Dutta, Seemanta schrieb:
The way I decided to remedy this problem was with the below steps:
1. Call g_thread_init() in the main function before gtk_init() is
2. In the callback for 'clicked' signal for the'Burn' button, I use
g_thread_create() to create a new thread which will handle the burning
of the micro processor.
3. I immediately return from the callback and control goes back to
MY PROBLEM: With the above approach, my application works for the
time. It just works perfectly. All the logs in the textviewer come up
sync with the actual process.
This looks as the usual problem: Your description sounds like you are
updating the textview from *within* the worker thread.
Although it's possible to update the GUI from more than one thread
this is not recommend, as it is tricky to do the locks the right way.
I suggest you should search this mailing list for threading, this
is discussed here nearly once a week.
Only when I press BURN for the second time, the textviwer does not
any logs, although I can see log statements in my console and it also
performs its work of programming the microprocessor.
The locking seem to be wrong...
I'll try to remove all Gtk calls from worker thread and only update
the GUI from main Gtk thread. The data for the log textviewer
can be sent with a thread save queue (with locking) or simple over
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
] [Thread Prev