[linux-audio-dev] Multithreaded programming for a poll model?

Paul Davis paul at linuxaudiosystems.com
Thu Jun 17 23:23:00 UTC 2004


>and don't care if the signal is lost.  Is there any advantage to 
>calling trylock() before doing that, or is signalling on a condition 
>you have no mutex interest in an OK thing to do?

the semantics of condition_wait/condition_signal require that

    IF condition_wait() has been called AND condition_signal() is
    called THEN the waiter will wake up

you cannot satisfy these semantics without the mutex, as tim
demonstrated. if you want some other semantics, maybe you can get by
without it. i know i've been bitten by race conditions caused by
trying to do this several times, and they are hard to track down and
identify. i also don't use conditions for RT stuff - they are not RT
safe. currently, i use FIFO's, and i plan to switch to futexes when
they become available. NPTL uses futexes to implement condition
variables, but linuxthreads uses signals.

--p



More information about the Linux-audio-dev mailing list