Gilles Chanteperdrix wrote:
> Jan Kiszka wrote:
>> Gilles Chanteperdrix wrote:
>>> Jan Kiszka wrote:
>>>> +  xnarch_atomic_set(mutex->owner,
>>>> +                    set_claimed(xnthread_handle(owner),
>>>> +                                xnsynch_nsleepers(&mutex->synchbase)));
>>> Ok. I think you have spotted a bug here. This should be mutex->sleepers
>>> instead of xnsynch_nsleepers.
>> BTW, why do you need to track sleepers separately in POSIX? Native
>> doesn't do so, e.g.
> 
> Because of the "syscall-needed-when-unlocking-stolen-mutex" issue I
> already explained (sleepers - xnsynch_nsleepers is precisely the count
> of pending threads which have been awake then robbed the mutex).

Hmm, sounds like the new lock owner should better clear the 'claimed'
bit then, not the old one on return from unlock. Or where is the
pitfall? How does the futex algorithm handle this scenario?

Jan

-- 
Siemens AG, Corporate Technology, CT SE 2
Corporate Competence Center Embedded Linux

_______________________________________________
Xenomai-core mailing list
Xenomai-core@gna.org
https://mail.gna.org/listinfo/xenomai-core

Reply via email to