Opened 9 years ago
Closed 9 years ago
#9094 closed Support Requests (invalid)
Missing boot::thread::thread(detail::thread_data_ptr data) constructor implementation for pthreads
| Reported by: | Owned by: | viboes | |
|---|---|---|---|
| Milestone: | To Be Determined | Component: | thread |
| Version: | Boost 1.54.0 | Severity: | Not Applicable |
| Keywords: | thread, constructor | Cc: |
Description
pthread's implementation of thread.cpp missing thread::thread(detail::thread_data_ptr data) constructor implementation. I have copied implementation from win32-version of thread.cpp and all going ok:
thread::thread(detail::thread_data_ptr data):
thread_info(data)
{}
Please, fix this little bug in new release if possible.
Change History (8)
comment:1 by , 9 years ago
comment:2 by , 9 years ago
| Owner: | changed from to |
|---|---|
| Status: | new → assigned |
comment:3 by , 9 years ago
I have commented this line on windows and everything works
explicit thread(detail::thread_data_ptr data);
It seems it is not used.
comment:4 by , 9 years ago
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)
{}
comment:5 by , 9 years ago
Sorry, this constructor is not in the public documented interface.
Please let me know why you can not do what you want to do with the public interface, I will try to fix anything is really needed.
comment:6 by , 9 years ago
| Type: | Bugs → Support Requests |
|---|
comment:7 by , 9 years ago
| Severity: | Problem → Not Applicable |
|---|
comment:8 by , 9 years ago
| Resolution: | → invalid |
|---|---|
| Status: | assigned → closed |
Closed as you are using details of the implementation. Please create a feature request for whatever new feature you need.

Please, could you add an example, the compiler, platform and error you are getting.