Merge lp://qastaging/~alan-griffiths/mir/doodle-in-TimeoutFrameDroppingPolicy-code into lp://qastaging/mir
Proposed by
Alan Griffiths
Status: | Rejected |
---|---|
Rejected by: | Alan Griffiths |
Proposed branch: | lp://qastaging/~alan-griffiths/mir/doodle-in-TimeoutFrameDroppingPolicy-code |
Merge into: | lp://qastaging/mir |
Diff against target: |
79 lines (+29/-13) 1 file modified
src/server/compositor/timeout_frame_dropping_policy_factory.cpp (+29/-13) |
To merge this branch: | bzr merge lp://qastaging/~alan-griffiths/mir/doodle-in-TimeoutFrameDroppingPolicy-code |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Alberto Aguirre (community) | Needs Fixing | ||
PS Jenkins bot (community) | continuous-integration | Approve | |
Review via email:
|
Commit message
compositor: Use lock to avoid races in TimeoutFrameDro
Description of the change
compositor: use lock to avoid races in TimeoutFrameDro
The old implementation was accidentally reliant on the alarm implementation synchronizing alarm calls and invocation of the lambda. This revision aims to make TimeoutFrameDro
To post a comment you must log in.
Unmerged revisions
- 1764. By Alan Griffiths
- 1763. By Alan Griffiths
-
Alberto's fix for race decrementing pending_swaps
- 1762. By Alan Griffiths
-
Avoid some raciness in TimeoutFrameDro
ppingPolicy
This: guard<std: :mutex> lock{mutex}; return --pending_swaps > 0; }())
64+ if ([&]{ std::lock_
should be:
bool update_ alarm{false} ; :lock_guard< std::mutex> lock{mutex};
bool reschedule{false};
{
std:
update_alarm = pending_swaps > 0;
reschedule = update_alarm && --pending_swaps > 0;
}
if (update_alarm)
alarm- >reschedule_ in(timeout) ;
alarm- >cancel( );
{
if (reschedule)
else
}
This should address the following scenario:
Assume pending_swaps = 1
timeout occurs and Thread A executes alarm handler,
since pending_swaps = 1, after
37+ call_drop = pending_swaps > 0;
38+ reshedule = call_drop && --pending_swaps > 0;
pending_swaps = 0
call_drop = true
reshedule = false
Let's say Thread A gets pre-empted before invoking drop_frame()
Thread B calls swap_unblocked, now pending_swaps = -1