[Top][All Lists]

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

Re: [fluid-dev] Thread safety

From: josh
Subject: Re: [fluid-dev] Thread safety
Date: Fri, 29 May 2009 17:31:39 -0400
User-agent: Internet Messaging Program (IMP) H3 (4.1.6)

Quoting address@hidden:

Yeah, I also came to that conclusion (one FIFO per thread).  Adding the
FIFOs wouldn't be that difficult.  Just have a fixed size array
(maximum number of threads), which is initialized with NULLs.  A
GPrivate (private data per thread) could be used to assign a FIFO to
the thread, the pointer to the FIFO could then be added to the array,
by looping on it and using g_atomic_int_compare_and_exchange() on NULL
values until it returns TRUE.

The synthesis thread could then just use g_atomic_int_get() when
iterating over the array to process the FIFOs and stop at the first
NULL (queues would never go away).

Oops, I meant g_atomic_pointer_* not g_atomic_int_* ..


reply via email to

[Prev in Thread] Current Thread [Next in Thread]