[Boost-bugs] [Boost C++ Libraries] #2742: Why the at_thread_exit cleanup function is const?

Subject: [Boost-bugs] [Boost C++ Libraries] #2742: Why the at_thread_exit cleanup function is const?
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2009-02-10 16:51:34


#2742: Why the at_thread_exit cleanup function is const?
----------------------------+-----------------------------------------------
 Reporter: viboes | Owner: anthonyw
     Type: Bugs | Status: new
Milestone: Boost 1.39.0 | Component: thread
  Version: Boost 1.37.0 | Severity: Problem
 Keywords: at_thread_exit |
----------------------------+-----------------------------------------------
 If I remove the const on operator()()

 {{{
 #!cpp
     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?

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/2742>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:49:59 UTC