Opened 7 years ago
Closed 7 years ago
#11796 closed Bugs (fixed)
Thread move assignment operator, does not detach previous thread data
Reported by: | Owned by: | viboes | |
---|---|---|---|
Milestone: | Boost 1.60.0 | Component: | thread |
Version: | Boost 1.59.0 | Severity: | Problem |
Keywords: | Cc: |
Description
In thread V2, thread dtor releases thread data, but move assignment operator won't release current threads data before pointing to others data.
I've attached a sample program which reproduces this problem.
(Tested on Ubuntu 15.10 with gcc 5.2.1)
Attachments (1)
Change History (8)
by , 7 years ago
Attachment: | thread.cpp added |
---|
comment:1 by , 7 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:2 by , 7 years ago
comment:4 by , 7 years ago
I've tested with c++11.
It only happens with thread V2, because with V3 not joining/detaching a joinable thread leads to std::terminate.
Actually the attached file does not show any error, and that's because I added a thread detach before assigning to a new instance. so If you want to see the error you should remove line 8, and you'll get thread resource error.
follow-up: 6 comment:5 by , 7 years ago
Milestone: | To Be Determined → Boost 1.60.0 |
---|
You are right. Please let me know if the following works for you.
https://github.com/boostorg/thread/commit/9f55587ab0236ac1ea4203a3c0c44bc9f252f236
comment:7 by , 7 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
By V2, do you mean that if you add -DBOOST_THREAD_VERSION=3, the issue is not present?