On 12/29/2011 09:39 PM, Terry Fryar wrote:
> Using Xenomai 2.6.0, I have a question regarding the use of condition
> variables. I think I understand why the mutex is required, but how to use
> it is a bit of a mystery?
>
> - To call "rt_cond_signal()", do you have to have the mutex acquired??
>
> - I assume to call "rt_cond_wait()", you are required to have the mutex
> acquired, yes??
You have to hold the mutex both for rt_cond_signal() and rt_cond_wait().
The following exercpt from linuxthreads man pages explains it:
A condition variable must always be associated with a mutex, to avoid
the race condition where a thread prepares to wait on a condition vari‐
able and another thread signals the condition just before the first
thread actually waits on it.
--
Gilles.
_______________________________________________
Xenomai-help mailing list
[email protected]
https://mail.gna.org/listinfo/xenomai-help