Opened 10 years ago
Last modified 8 years ago
#7586 assigned Feature Requests
Add a testable_mutex
Reported by: | viboes | Owned by: | viboes |
---|---|---|---|
Milestone: | Component: | thread | |
Version: | Boost 1.52.0 | Severity: | Problem |
Keywords: | Cc: |
Description
Based on Associate Mutexes with Data to Prevent Races, By Herb Sutter, May 13, 2010 - http://www.drdobbs.com/windows/associate-mutexes-with-data-to-prevent-r/224701827?pgno=3
"Make our mutex testable if it isn't already.
Many mutex services (including boost::mutex) don't provide a way to ask, "Do I already hold a lock on this mutex?"
Sometimes it is needed to know if a method like is_held to be available.
This wrapper associates an arbitrary lockable type with a thread id that stores the ID of the thread that currently holds the lockable. The thread id initially holds an invalid value that means no threads own the mutex.
When we acquire a lock, we set the thread id; and when we release a lock, we reset it back to its default no id state."
Change History (7)
comment:1 by , 10 years ago
Milestone: | To Be Determined |
---|
comment:2 by , 10 years ago
Status: | new → assigned |
---|
comment:4 by , 10 years ago
Milestone: | → Boost 1.55.0 |
---|
comment:5 by , 9 years ago
Milestone: | Boost 1.55.0 → Boost 1.56.0 |
---|
comment:6 by , 9 years ago
Milestone: | Boost 1.56.0 → Boost 1.57.0 |
---|
comment:7 by , 8 years ago
Milestone: | Boost 1.57.0 |
---|
Committed in trunk revision [81088].