Merge lp:~phablet-team/media-hub/fix-1457129 into lp:media-hub
| Status: | Merged | ||||
|---|---|---|---|---|---|
| Approved by: | Ricardo Salveti on 2015-05-27 | ||||
| Approved revision: | 142 | ||||
| Merged at revision: | 141 | ||||
| Proposed branch: | lp:~phablet-team/media-hub/fix-1457129 | ||||
| Merge into: | lp:media-hub | ||||
| Diff against target: |
122 lines (+58/-15) 1 file modified
src/core/media/power/state_controller.cpp (+58/-15) |
||||
| To merge this branch: | bzr merge lp:~phablet-team/media-hub/fix-1457129 | ||||
| Related bugs: |
|
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| PS Jenkins bot | continuous-integration | Needs Fixing on 2015-05-27 | |
| Thomas Voß (community) | code | 2015-05-27 | Approve on 2015-05-27 |
|
Review via email:
|
|||
Commit Message
Use try_lock() instead of a lock_guard to fail gracefully from rare deadlock situations.
Description of the Change
Use try_lock() instead of a lock_guard to fail gracefully from rare deadlock situations.
| PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:142
http://
Executed test runs:
FAILURE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://

Please use a std::unique_lock instead of manually try-locking/ unlocking the mutex. Would look like:
std:: unique_ lock<std: :mutex> ul{system_ state_cookie_ store_guard, std::try_to_lock};
if (ul.owns_lock())
{
// do stuff.
}
With that, the mutex is always unlocked, even in the case of exceptions.