using threads with GTK+
- From: Paul Pogonyshev <pogonyshev gmx net>
- To: gtk-app-devel-list gnome org
- Subject: using threads with GTK+
- Date: Tue, 23 Dec 2003 23:19:51 +0000
Hi.
I'm going to use the following threads with GTK+:
- thread 1 does all GUI job (widgets etc.) and launches more threads
when needed;
- threads 2, ... (launched by 1) do some time consuming computations
and inform thread 1 once they are done so it can present the results
to user.
The only thing i'm not sure how to implement is how to let thread 1 know
when one of working threads is finished. Current best way i found while
studying GTK+ and Glib manuals is like this:
Thread 1 uses a new event source in its the main loop which pops events
from a GAsyncQueue. Once a working thread finishes it jobs, it pushes a
structure onto the queue, calls g_main_context_wakeup() to wake thread 1
up if needed, and terminates.
This does not seem to be very hard to implement, but before starting on
it, i would like to be sure i didn't miss some more simple way of
implementing the schema above.
Paul Pogonyshev
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]