[Boost-bugs] [Boost C++ Libraries] #5542: Segmentation fold in boost/thread.hpp

Subject: [Boost-bugs] [Boost C++ Libraries] #5542: Segmentation fold in boost/thread.hpp
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2011-05-13 22:28:35


#5542: Segmentation fold in boost/thread.hpp
--------------------------------------------------+-------------------------
 Reporter: One People <leonardo777@…> | Owner: anthonyw
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: thread
  Version: Boost 1.46.1 | Severity: Problem
 Keywords: thread segmentation fold |
--------------------------------------------------+-------------------------
 Every time I`m 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.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/5542>
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:06 UTC