Skip to contentSkip to conversation

xeno3_rc3_alchemy What is the effect of rt_task_delete on a RT_SEM?

Xenomai Applied Niels Wellens 3 participants 3 messages Mar 13, 2015 – Mar 15, 2015

lore
Share & tools
lore
#0 lore raw

Hi,

While porting our code to xeno3 I noticed that one of our tasks blocked on a semaphore during exit (code worked on xeno 2.6.4 Native, some small changes where needed for Alchemy but nothing fundamental). It seems that deletion of a task that is waiting on a RT_SEM doesn't decrement the nwaiters field of the semaphore. Afterwards, when I raise the semaphore, the nwaiters decrement without releasing an existing task. Are there some changes here in Xeno3? I looked in the migration guide but the only remark about semaphores is for posix.

Please find in attachment a small working example with some comments in the exit part of the code.

Thanks in advance!
Kind regards,
Niels
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Makefile
Type: text/x-makefile
Size: 2140 bytes
Desc: not available
URL: <http://www.xenomai.org/pipermail/xenomai/attachments/20150313/83310ade/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sem_test.c
Type: text/x-csrc
Size: 3443 bytes
Desc: not available
URL: <http://www.xenomai.org/pipermail/xenomai/attachments/20150313/83310ade/attachment.c>

#1 lore raw
Quoted 11 lines · Niels Wellens

Hi,

While porting our code to xeno3 I noticed that one of our tasks blocked on a semaphore during exit (code worked on xeno 2.6.4 Native, some small changes where needed for Alchemy but nothing fundamental). It seems that deletion of a task that is waiting on a RT_SEM doesn't decrement the nwaiters field of the semaphore. Afterwards, when I raise the semaphore, the nwaiters decrement without releasing an existing task. Are there some changes here in Xeno3? I looked in the migration guide but the only remark about semaphores is for posix.

Quoted 2 lines

Please find in attachment a small working example with some comments in the exit part of the code.

I've pushed two related patches to
http://git.xenomai.org/xenomai-jki.git/log/?h=for-forge. The first one fixes the semaphore value after interrupted waiting as you saw it, the second one the reported nwaiters value if the semaphore is positive (unrelated but caught by your test case as well).

Thanks for reporting and specifically for preparing the test case that well!

Jan

Signature · 2 lines
Siemens AG, Corporate Technology, CT RTC ITP SES-DE
Corporate Competence Center Embedded Linux
#2 lore raw
Quoted 15 lines · Jan Kiszka
Quoted 11 lines · Niels Wellens

Hi,

While porting our code to xeno3 I noticed that one of our tasks blocked on a semaphore during exit (code worked on xeno 2.6.4 Native, some small changes where needed for Alchemy but nothing fundamental). It seems that deletion of a task that is waiting on a RT_SEM doesn't decrement the nwaiters field of the semaphore. Afterwards, when I raise the semaphore, the nwaiters decrement without releasing an existing task. Are there some changes here in Xeno3? I looked in the migration guide but the only remark about semaphores is for posix.

Quoted 2 lines

Please find in attachment a small working example with some comments in the exit part of the code.

Quoted 8 lines

I've pushed two related patches to
http://git.xenomai.org/xenomai-jki.git/log/?h=for-forge. The first one fixes the semaphore value after interrupted waiting as you saw it, the second one the reported nwaiters value if the semaphore is positive (unrelated but caught by your test case as well).

Thanks for reporting and specifically for preparing the test case that well!

Merged, thanks.

Signature · 1 line
Philippe.