Opened 11 years ago
Closed 10 years ago
#5542 closed Bugs (worksforme)
Segmentation fold in boost/thread.hpp Linux -x86_64
Reported by: | Owned by: | viboes | |
---|---|---|---|
Milestone: | To Be Determined | Component: | thread |
Version: | Boost 1.46.1 | Severity: | Problem |
Keywords: | thread segmentation fold | Cc: | g++ 4.5 |
Description
Every time Im trying to create new thread, I receve an Segmentation Fold. Even in the simplest examples founded in internet. Debugger in NetBeans has shown me, that this problem happends, while I
m trying to do start_thread() - method from thread class included in boost/thread.hpp - file.
Computer specification:
- procesor i7 720QM (I`ve seen some asm code)
- linux mint 10 - Julia
- kernel version 2.6.38.2
Compilation command: g++-4.5 -pthread -lboost_thread t1.cpp -o t1
Example code used:
#include <iostream> #include <boost/thread.hpp> class Worker { public: Worker() { // the thread is not-a-thread until we call start() } void start(int N) { std::cout << "start\n"; m_Thread = boost::thread(&Worker::processQueue, this, N); std::cout << "started\n"; } void join() { m_Thread.join(); } void processQueue(unsigned N) { float ms = N * 1e3; boost::posix_time::milliseconds workTime(ms); std::cout << "Worker: started, will work for " << ms << "ms" << std::endl; // We're busy, honest! boost::this_thread::sleep(workTime); std::cout << "Worker: completed" << std::endl; } private: boost::thread m_Thread; }; int main(int argc, char* argv[]) { std::cout << "main: startup" << std::endl; Worker worker; std::cout << "main: create worker" << std::endl; worker.start(3); std::cout << "main: waiting for thread" << std::endl; worker.join(); std::cout << "main: done" << std::endl; return 0; }
More included as files.
Attachments (2)
Change History (7)
by , 11 years ago
by , 11 years ago
comment:1 by , 11 years ago
Summary: | Segmentation fold in boost/thread.hpp → Segmentation fold in boost/thread.hpp Linux -x86_64 |
---|
comment:2 by , 11 years ago
I'm having the same issue, and can confirm that this occurs even with the most trivial boost::thread program.
#include <boost/thread.hpp> void run_thread() { return; } int main() { boost::thread t(run_thread); return 0; }
And the backtrace (built in release mode with debug symbols, so I'm not sure how useful it is):
#0 operator= (this=0x7fffffffd670) at ./boost/smart_ptr/shared_ptr.hpp:305 #1 boost::thread::start_thread (this=0x7fffffffd670) at libs/thread/src/pthread/thread.cpp:185 #2 0x00000000004025e2 in boost::thread::thread<void (*)()>(void (*)(), boost::disable_if<boost::is_convertible<void (*&)(), boost::detail::thread_move_t<void (*)()> >, boost::thread::dummy*>::type) () #3 0x000000000040182a in main ()
Boost version is 1.6.1, built with gcc (Gentoo 4.4.5 p1.2, pie-0.4.5) 4.4.5
comment:4 by , 11 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
When I compile the attached examples (the 3) with bjam on the trunk everything is OK. Could you tell me if you are able to reproduce using the trunk?
Another used example code