Re: Pushing a NULL into g_async_queue



On Tue, 2005-03-01 at 09:18 -0800, Alan M. Evans wrote:

> > In answer to your question, consider the g_async_queue_try_pop() and 
> > g_async_queue_timed_pop() functions.  They will either return a value 
> > from the queue, or NULL if no items exist.  If you can store NULLs in 
> > the queue, then the result becomes ambiguous.
> 
> That's a pity. Using GINT_TO_POINTER is a convenient way to pass short
> messages through a queue. If I can't find a way to avoid zero as a value
> then I'll have to pass a pointer to an int, which means that I now have
> to worry about the lifespan of the int. I guess what this means is
> g_new(int) at one end and g_free() at the other -- yuck.

If your ints are nonnegative, just add 1 to them :)

  Federico




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