-
Notifications
You must be signed in to change notification settings - Fork 7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixed undefined behaviour in ThreadPool #4612
Conversation
} | ||
|
||
private: | ||
std::shared_ptr<std::mutex> mutex; /// Object must be moveable. | ||
/// The state used in this object and inside the thread job. | ||
std::shared_ptr<Poco::Event> state; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe finished_event
is more clear
@ztlpn f49562b
|
No changes to the previous release.
Detailed description (optional):
We lock mutex in one thread (when constructing
ThreadFromGlobalPool
object) and unlock in another (whenshared_ptr<std::mutex>
is destroyed in the task).According to the C++ standard:
And this code failed in FreeBSD with
Resource deadlock avoided
message.