Opened 8 years ago
Closed 8 years ago
#11119 closed Bugs (fixed)
mutex::unlock must not throw
| Reported by: | viboes | Owned by: | viboes |
|---|---|---|---|
| Milestone: | Boost 1.58.0 | Component: | thread |
| Version: | Boost 1.57.0 | Severity: | Problem |
| Keywords: | Cc: |
Description (last modified by )
The Mutex requirements say
m.unlock();
Requires:
The current thread owns m.
Synchronization:
This operation synchronizes with subsequent lock operations that obtain ownership on the same object.
Effects:
Releases a lock on m by the current thread.
Return type:
void.
Throws:
Nothing.
However mutex::unlock throws an exception.
void unlock()
{
int res = posix::pthread_mutex_unlock(&m);
if (res)
{
boost::throw_exception(lock_error(res,"boost: mutex unlock failed in pthread_mutex_unlock"));
}
}
Change History (3)
comment:1 by , 8 years ago
| Description: | modified (diff) |
|---|---|
| Owner: | changed from to |
| Status: | new → assigned |
comment:2 by , 8 years ago
| Summary: | mutex::lock must not throw → mutex::unlock must not throw |
|---|
comment:3 by , 8 years ago
| Milestone: | To Be Determined → Boost 1.58.0 |
|---|---|
| Resolution: | → fixed |
| Status: | assigned → closed |
Note:
See TracTickets
for help on using tickets.

void unlock() { int res = posix::pthread_mutex_unlock(&m); (void)res; BOOST_ASSERT(res == 0); // if (res) // { // boost::throw_exception(lock_error(res,"boost: mutex unlock failed in pthread_mutex_unlock")); // } }