Bug in sem_timedwait()

Joel Sherrill <joel@OARcorp.com> joel.sherrill at OARcorp.com
Mon May 23 20:04:08 UTC 2005

Peter Dufault wrote:
> There is a bug in the POSIX sem_timedwait() implementation.  The  struct 
> timespec() is supposed to be an absolute timeout but it is  implemented 
> as a relative timeout.  The same code that is in  condtimedwait() (or 
> even better, extract that code to a single place)  needs to be put in 
> there.

If you feel like this is something you can do, I invite you do
go ahead and do it.  Even if you want a doublecheck, it is better
than waiting for someone else to write it. :)

> Also, sem_timedwait needs to obey the rule that the timeout need not  be 
> valid if the semaphore can be locked immediately.  I didn't check  that.
> I'll open a bug report.  I don't think bug reports are sent to the  list 
> so I posted this as well.

That's the best thing to do.  Sometimes bugs do get fixed by being 
mentioend on the list but often they just get forgotten if not dealt
with immediately.

> Peter

Joel Sherrill, Ph.D.             Director of Research & Development
joel at OARcorp.com                 On-Line Applications Research
Ask me about RTEMS: a free RTOS  Huntsville AL 35805
    Support Available             (256) 722-9985

More information about the users mailing list