#1291 closed defect (fixed)

POSIX Blocking Calls with Timeouts as Absolute Times

Reported by: Joel Sherrill Owned by: Joel Sherrill
Priority: normal Milestone: 4.9
Component: score Version: 4.9
Severity: normal Keywords:
Cc: Blocked By:
Blocking:

Description

This patch addresses issues on implementation of the timeout on the following POSIX services. Some of these services incorrectly took a timeout as a relative time. Others would compute a 0 delta to timeout if the absolute time and the current time were equal and thus incorrectly block the caller forever. The root of the confusion is that POSIX specifies that if the timeout is incorrect (e.g. in the past, is now, or is numerically invalid), that it does not matter if the call would succeed without blocking. This is in contrast to RTEMS programming style where all errors are checked before any critical sections are entered.

This fix implemented a more uniform way of handling POSIX absolute time timeouts.

pthread_cond_timedwait - could block forever
mq_timedreceive - used relative not absolute time
mq_timedsend - used relative not absolute time
pthread_mutex_timedlock - used relative not absolute time
pthread_rwlock_timedrdlock- used relative not absolute time
pthread_rwlock_timedwrlock- used relative not absolute time
sem_timedwait - could block forever

Attachments (3)

pr1291-cvs.diff (52.9 KB) - added by Joel Sherrill on 07/18/08 at 17:43:16.
Fix against CVS.
pr1291-48.diff (44.6 KB) - added by Joel Sherrill on 07/22/08 at 16:16:30.
version of patch for 4.8 branch.
pr1291-47.diff (44.7 KB) - added by Joel Sherrill on 07/24/08 at 19:01:30.
version of patch for 4.7 branch.

Download all attachments as: .zip

Change History (4)

Changed on 07/18/08 at 17:43:16 by Joel Sherrill

Attachment: pr1291-cvs.diff added

Fix against CVS.

Changed on 07/22/08 at 16:16:30 by Joel Sherrill

Attachment: pr1291-48.diff added

version of patch for 4.8 branch.

Changed on 07/24/08 at 19:01:30 by Joel Sherrill

Attachment: pr1291-47.diff added

version of patch for 4.7 branch.

comment:1 Changed on 08/04/08 at 13:59:55 by Joel Sherrill

Resolution: fixed
Status: newclosed

Patch applied to all active branches and tested.

Note: See TracTickets for help on using tickets.