Re: [Boost-bugs] [Boost C++ Libraries] #9094: Missing boot::thread::thread(detail::thread_data_ptr data) constructor implementation for pthreads

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #9094: Missing boot::thread::thread(detail::thread_data_ptr data) constructor implementation for pthreads
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2013-09-10 08:11:25


#9094: Missing boot::thread::thread(detail::thread_data_ptr data) constructor
implementation for pthreads
-------------------------------+---------------------------------
  Reporter: leonardo@… | Owner: viboes
      Type: Bugs | Status: assigned
 Milestone: To Be Determined | Component: thread
   Version: Boost 1.54.0 | Severity: Problem
Resolution: | Keywords: thread, constructor
-------------------------------+---------------------------------

Comment (by leonardo@…):

 We a using boost::thread in our cross-platform code (Windows XP/Vista/7/8
 and Linux Debian 7.0). Used compilers: MSVC++ v.9.0 (vs2008), GCC v.4.6.3.

 On Windows platform we have no problems while building our code. On Linux
 (GCC v.4.6.3) we have an error while trying to link boost_thread.a
 library, cause it has no implementation of thread(detail::thread_data_ptr
 data).

 This constructor is only the way to separate thread initialization from
 starting/stopping/restarting thread execution, for ex.:

 {{{

 // our wrapper-class for thread
 class thread_object_t :
         public virtual thread_object_i // thread-object interface
 {
 private:
         vptr_t thread_args; // thread entry custom arguments
         boost::thread thread_impl; // using boost::thread
 implementation

 ...

 };

 // init thread object, setting thread entry to
 thread_object_t::thread_impl_entry()
 void thread_object_t::init_thread_impl()
 {
         thread_impl =
 boost::thread(boost::thread::make_thread_info(boost::bind(boost::type<void>(),
 thread_impl_entry, this)));
 }

 // thread start method, separated from thread initialization (with custom
 stack size)
 void thread_object_t::start(vptr_t new_thread_args)
 {
         thread_args = new_thread_args;

         boost::thread_attributes thread_attributes;
         thread_attributes.set_stack_size(max_stack_size);
         thread_impl.start_thread(thread_attributes);
 }
 }}}

 Please, don't remove this constructor, cause it is only the way to do
 things that we need (flexible controll of thread-entry, thread stack,
 thread execution).

 Simple solution is to use one implementation of this constructor for both
 win32 and pthread versions:

 {{{
 thread::thread(detail::thread_data_ptr data):
         thread_info(data)
     {}
 }}}

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/9094#comment:4>
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:50:14 UTC