View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0000239 | 1003.1(2008)/Issue 7 | System Interfaces | public | 2010-04-13 14:43 | 2013-04-16 13:06 |
Reporter | geoffclare | Assigned To | ajosey | ||
Priority | normal | Severity | Comment | Type | Error |
Status | Closed | Resolution | Accepted | ||
Name | Geoff Clare | ||||
Organization | The Open Group | ||||
User Reference | |||||
Section | pthread_cond_timedwait | ||||
Page Number | 1590 | ||||
Line Number | 51186 | ||||
Interp Status | --- | ||||
Final Accepted Text | |||||
Summary | 0000239: minor correction to pthread_cond_timedwait() example code | ||||
Description | At the end of the rationale on the pthread_cond_timedwait() page there is some example code showing the use of pthread_cond_timedwait(), which includes the following: rc = 0; while (! mypredicate(&t) && rc == 0) rc = pthread_cond_timedwait(&t.cond, &t.mn, &ts); t.waiters--; if (rc == 0) setmystate(&t); This follows the advice stated near the beginning of the rationale: "The application needs to recheck the predicate on any return" in that the code correctly checks the predicate in the while condition. However, there is a possible code path where rc is set to ETIMEDOUT but then the predicate is true in the while condition, in which case the code after the loop fails to act on the predicate being true. | ||||
Desired Action | Change if (rc == 0) setmystate(&t); to if (rc == 0 || mypredicate(&t)) setmystate(&t); | ||||
Tags | tc1-2008 |
Date Modified | Username | Field | Change |
---|---|---|---|
2010-04-13 14:43 | geoffclare | New Issue | |
2010-04-13 14:43 | geoffclare | Status | New => Under Review |
2010-04-13 14:43 | geoffclare | Assigned To | => ajosey |
2010-04-13 14:43 | geoffclare | Name | => Geoff Clare |
2010-04-13 14:43 | geoffclare | Organization | => The Open Group |
2010-04-13 14:43 | geoffclare | Section | => pthread_cond_timedwait |
2010-04-13 14:43 | geoffclare | Page Number | => 1590 |
2010-04-13 14:43 | geoffclare | Line Number | => 51186 |
2010-04-13 14:43 | geoffclare | Interp Status | => --- |
2010-04-22 15:11 | ajosey | Status | Under Review => Resolved |
2010-04-22 15:11 | ajosey | Resolution | Open => Accepted |
2010-08-27 11:24 | ajosey | Tag Attached: tc1-2008 | |
2013-04-16 13:06 | ajosey | Status | Resolved => Closed |