#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 Jul 18, 2008 at 5:43:16 PM.
Fix against CVS.
pr1291-48.diff (44.6 KB) - added by Joel Sherrill on Jul 22, 2008 at 4:16:30 PM.
version of patch for 4.8 branch.
pr1291-47.diff (44.7 KB) - added by Joel Sherrill on Jul 24, 2008 at 7:01:30 PM.
version of patch for 4.7 branch.

Download all attachments as: .zip

Change History (4)

Changed on Jul 18, 2008 at 5:43:16 PM by Joel Sherrill

Attachment: pr1291-cvs.diff added

Fix against CVS.

Changed on Jul 22, 2008 at 4:16:30 PM by Joel Sherrill

Attachment: pr1291-48.diff added

version of patch for 4.8 branch.

Changed on Jul 24, 2008 at 7:01:30 PM by Joel Sherrill

Attachment: pr1291-47.diff added

version of patch for 4.7 branch.

comment:1 Changed on Aug 4, 2008 at 1:59:55 PM by Joel Sherrill

Resolution: fixed
Status: newclosed

Patch applied to all active branches and tested.

Note: See TracTickets for help on using tickets.