Re: Some question about thread pools

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.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]