Re: Some question about thread pools
- From: Havoc Pennington <hp redhat com>
- To: Axel Bock <news-and-lists the-me de>
- Cc: GTK App devel list <gtk-app-devel-list gnome org>
- Subject: Re: Some question about thread pools
- Date: Sun, 8 Dec 2002 09:47:04 -0500
On Sun, Dec 08, 2002 at 03:31:16PM +0100, Axel Bock wrote:
Well, I have some pice of data arriving occasionally over the net. The
processing of this data takes a quite long time, and so I wanted to give
this data over to a thread pool to deal with this.
I would init the pool with
tp = g_thread_pool_new(func, NULL???, num, TRUE, NULL);
(This seems strange to me - I don't have any user data yet when
initializing the thread pool ... or did I get something wrong here?)
The user_data here is passed to *all* jobs, so it's a place to put
some shared information. For example a count of packets processed, or
something like that.
Assuming the init went correct I would push the arriving packets
(the pointers to them ;-) with
g_thread_pool_push(tp, my_pointer, NULL);
to give them some meat.
] [Thread Prev