On 11/10/2010 02:45 PM, Stefan Hajnoczi wrote:
I wonder if the condition variable has a measurable performance overhead. We unconditionally broadcast on paiocb completion. One idea would be to keep a counter of waiters (should only ever be 0 or 1) protected by aiocb_mutex and broadcast only when there is a waiter.
This should be handled anyway by the pthreads library. If we are sure there is only one waiter at most, you can change broadcast to signal but that would already be microoptimization.
Alternatively, you can use futexes to implement a completion signal (similar to Win32 events). But it seems too much effort.
Paolo