2013/1/22 Philippe Gerum <r...@xenomai.org>

> On 01/22/2013 10:41 AM, alex alex wrote:
>
>> Hi,
>>
>> In the attached test program I test the scheduler lock operation with
>> pthread_set_mode_np and the PTHREAD_LOCK_SCHED bit mask.
>>
>> Description:
>> Two tasks are created.
>> t1 lock the scheduler then load the cpu, sleep then load the cpu again but
>> t2 task start when t1 sleep while the scheduler is locked. Why t1 is
>> preempted?
>>
>
> Think of what would happen would a blocked task be allowed to keep the
> scheduler lock.
>
>
>>
According to the documentation :
"PTHREAD_LOCK_SCHED when set, locks the scheduler, which prevents the
current thread from being switched out by the scheduler until the scheduler
is unlocked"
This is what t1 do, locking the scheduler then unlocked it.
t1 shouldn't be switched out until the scheduler be unlocked.
_______________________________________________
Xenomai mailing list
Xenomai@xenomai.org
http://www.xenomai.org/mailman/listinfo/xenomai

Reply via email to