Re: Thread programming
- From: Tim Müller <zen18864 zen co uk>
- To: gtk-app-devel-list gnome org
- Subject: Re: Thread programming
- Date: Mon, 16 Jun 2003 18:49:04 +0100
On Monday 16 June 2003 17:32, Tristan Van Berkom wrote:
Hi,
This could work,
- Create a GQueue and a GMutex to handle the queue.
- in your main (GUI updating) thread, create a g_timeout_add
function and every once and a while, come and check the queue like so
...
g_mutex_lock(queue_mutex);
/* process data in queue */
g_mutex_unlock(queue_mutex);
....
- in your child thread; when you have ready data; lock your mutex,
add data to the queue and unlock mutex.
There's also GAsyncQueue, which does the same thing, but is slightly more
convenient to use IMHO.
Cheers
-Tim
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]