Opened 11 years ago
Closed 11 years ago
#5829 closed Support Requests (invalid)
condition.cpp: condition_impl::notify_all swallows errors from WaitForSingleObject
Reported by: | anonymous | Owned by: | viboes |
---|---|---|---|
Milestone: | To Be Determined | Component: | thread |
Version: | Boost 1.47.0 | Severity: | Problem |
Keywords: | Cc: | viboes |
Description
condition_impl::notify_all silently swallows errors from WaitForSingleObject. The author got the asserts correct, but took no action on failures.
My apologies for throwing a runtime_error. I'm not familiar enogh with boost to know what should be thrown. I also suspect the code should throw earlier than before function exit.
Index: condition.cpp =================================================================== RCS file: /cvsroot/boost/boost/libs/thread/src/condition.cpp,v retrieving revision 1.21 diff -r1.21 condition.cpp 133,135c133,135 < int res = 0; < res = WaitForSingleObject(reinterpret_cast<HANDLE>(m_mutex), INFINITE); < assert(res == WAIT_OBJECT_0); ---
int wait1 = WAIT_OBJECT_0, wait2 = WAIT_OBJECT_0, res = 0; wait1 = WaitForSingleObject(reinterpret_cast<HANDLE>(m_mutex), INFINITE); assert(wait1 == WAIT_OBJECT_0);
151,152c151,152 < res = WaitForSingleObject(reinterpret_cast<HANDLE>(m_gate), INFINITE); < assert(res == WAIT_OBJECT_0); ---
wait2 = WaitForSingleObject(reinterpret_cast<HANDLE>(m_gate), INFINITE); assert(wait2 == WAIT_OBJECT_0);
177a178,183
if(wait1 != WAIT_OBJECT_0)
throw std::runtime_error("Failed to wait on mutex");
if(wait2 != WAIT_OBJECT_0)
throw std::runtime_error("Failed to wait on gate");
Change History (4)
comment:1 by , 11 years ago
comment:2 by , 11 years ago
Component: | None → thread |
---|---|
Owner: | set to |
comment:3 by , 11 years ago
Cc: | added |
---|---|
Owner: | changed from | to
Status: | new → assigned |
Type: | Bugs → Support Requests |
Sorry, I don't see any file libs/thread/src/condition.cpp. Moved to support request until concerned file clarified.
comment:4 by , 11 years ago
Resolution: | → invalid |
---|---|
Status: | assigned → closed |
Closed as it seems this doesn't corresponds to the current Boost.Thread implementation.
assert(res == WAIT_OBJECT_0)
might be too tight -assert(res == WAIT_OBJECT_0 || res == WAIT_ABANDONED_0)
might be a better choice.