Opened 14 years ago
Closed 13 years ago
#2742 closed Patches (fixed)
Why the at_thread_exit cleanup function is const?
Reported by: | viboes | Owned by: | Anthony Williams |
---|---|---|---|
Milestone: | Boost 1.39.0 | Component: | thread |
Version: | Boost 1.37.0 | Severity: | Problem |
Keywords: | at_thread_exit | Cc: |
Description
If I remove the const on operator()()
struct mycallable1 { void operator()() { std::cout << "mycallable1" << std::endl; }; }; void my_thread() { std::cout << "my_thread" << std::endl; mycallable1 x; boost::this_thread::at_thread_exit(x); }
I get the following error:
gcc.compile.c++ ..\..\..\bin.v2\libs\interthreads\test\hello_world.test\gcc-4.3.2\debug\target-os-cygwin\threadapi-pthread\threading-multi\hello_world.o ../../../boost/thread/detail/thread.hpp: In member function `void boost::detail::thread_exit_function<F>::operator()() const [with F = mycallable1]': ..\example\hello_world.cpp:52: instantiated from here ../../../boost/thread/detail/thread.hpp:474: error: passing `const mycallable1' as `this' argument of `void mycallable1::operator()()' discards qualifiers
Why the cleanup function must be const?
Attachments (3)
Change History (6)
by , 13 years ago
Attachment: | thread.hpp added |
---|
by , 13 years ago
Attachment: | 2742.patch added |
---|
by , 13 years ago
Attachment: | test_ticket_2742.cpp added |
---|
comment:1 by , 13 years ago
comment:2 by , 13 years ago
Type: | Bugs → Patches |
---|
Note:
See TracTickets
for help on using tickets.
The attached files contains the test showing the bug and a patch solving the issue