Merge lp:~phablet-team/media-hub/fix-1457129 into lp:media-hub
Proposed by
Jim Hodapp
Status: | Merged | ||||
---|---|---|---|---|---|
Approved by: | Ricardo Salveti | ||||
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 | |
Thomas Voß (community) | code | Approve | |
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.
To post a comment you must log in.
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.