Bugs POSIX API Timer

Nico Forlano n.forlano at web.de
Mon Aug 5 19:38:04 UTC 2013


Hi,

I think I found two bugs / unexpected behaviour in the POSIX timer
implementation

1.) Emitted signal on timer expiration is only relayed to the thread which
created the timer instead of the process / all threads.
2.) When you initialize a timer with an interval of zero, the timer is
supposed to expire only once and then stop. You would expect that the
value remains at zero in this case, however in RTEMS the timer resets to
an arbitrary (?) value and starts counting down again.

I attached two examples that demonstrate both cases. If you compile them
on Linux, they behave as I would expect from the POSIX documentation.

Regarding 1.):
Sebastian Huber pointed out to me that  _POSIX_Timer_TSR() emits the
signal with an explicit call to pthread_kill(). From the POSIX
documentation I would have expected a signal to all threads of the process
using kill().

If this is changed I believe the psxtimer01 test from the POSIX part of
the testsuit has to be updated as well. There are three threads which all
create their own timer and all wait for a signal with the same signal
number. If the threads are not addressed directly with pthread_kill()
anymore I assume the highest priority thread will just grab the signals of
all timers, which does not seem to be the intention.

If the usage of pthread_kill() is intended, is there any way to set the ID
of the target thread?

Regards
Nico


-------------- next part --------------
A non-text attachment was scrubbed...
Name: posix_examples.tar
Type: application/octet-stream
Size: 20480 bytes
Desc: not available
URL: <http://lists.rtems.org/pipermail/users/attachments/20130805/e18213ec/attachment.obj>


More information about the users mailing list