Merge lp://qastaging/~afrantzis/mir/fix-1391488-basic-thread-pool-race into lp://qastaging/mir
Proposed by
Alexandros Frantzis
Status: | Merged | ||||
---|---|---|---|---|---|
Approved by: | Kevin DuBois | ||||
Approved revision: | no longer in the source branch. | ||||
Merged at revision: | 2086 | ||||
Proposed branch: | lp://qastaging/~afrantzis/mir/fix-1391488-basic-thread-pool-race | ||||
Merge into: | lp://qastaging/mir | ||||
Diff against target: |
97 lines (+43/-6) 1 file modified
src/server/thread/basic_thread_pool.cpp (+43/-6) |
||||
To merge this branch: | bzr merge lp://qastaging/~afrantzis/mir/fix-1391488-basic-thread-pool-race | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
PS Jenkins bot (community) | continuous-integration | Approve | |
Robert Carr (community) | Approve | ||
Alberto Aguirre (community) | Approve | ||
Alan Griffiths | Approve | ||
Review via email:
|
Commit message
server: Fix race in BasicThreadPool
Ensure a task is removed from the task queue before notifying that the task is
done. Otherwise, scheduling new tasks based on these notifications may cause
unnecessary threads to be created.
Description of the change
server: Fix race in BasicThreadPool
Ensure a task is removed from the task queue before notifying that the task is
done. Otherwise, scheduling new tasks based on these notifications may cause
unnecessary threads to be created.
This MP replaces std::packaged_
To post a comment you must log in.
52 + auto task = std::move( tasks.front( ));
53 lock.unlock();
54 - task();
55 + task.execute();
56 lock.lock();
57 tasks.pop_front();
Is it really safe to unlock between the "std::move( tasks.front( ));" and the "tasks. pop_front( );"?