[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [rtl] Stoping rttasks
> while (1) do
> {
> sentence1();
> sentence2();
> sentence3();
> pthread_wait_np();
> }
> Imagine that the execution is in "sentence1" and other task suspends
> this one with "pthread_suspend_np". Will this task stop right there or
> it will execute "sentence1", "sentence2", "sentence3" and stop in
> "pthread_wait_np"?. Many thanks.
It can stop anywhere, including the interval between
sentence2 and sentence3. If you need to make
sure it only stops at pthread_wait_np, you need to use something like
while (1) do
{
sentence1();
sentence2();
sentence3();
if (need_stop) {
pthread_suspend_np(pthread_self());
}
pthread_wait_np();
}
and set need_stop in another task.
Michael.