Boost logo

Boost Users :

From: Robert Marion (rob_marion1_at_[hidden])
Date: 2006-11-21 16:10:50


Hi,
I've written my first boost::thread application, and I
get this assertion:
/boost_1_33_1/libs/thread/src/thread.cpp:223: void
boost::thread::join(): Assertion 'm_joinable' failed.

I call the thread as:

void _pollMode( Controller& ctrl ) {
   // do polling ... for my testing, left blank
}

void SomeClass::startPolling() {
   m_pCtrl = new Controller;
   boost::function<void (Controller&)> funcPoll;
   funcPoll = &_pollMode;
   m_thr = new boost:thread(boost::bind( funcPoll,
*m_pCtrl));
// never get past this line (unless copy ctor
modified)
}

The Controller class has a copy constructor defined,
which gets called several times (by the thread class?)

Controller( const Controller& ctrl ) {
   boost::mutex::scoped_lock lock( m_mutex );
   m_thr = ctrl.m_thr; // bad ??

   BUT ... if I do m_thr = NULL; then everything is
ok. Why??? What's going on here???
}

Any help/explanation would be appreciated.
Rob

 
____________________________________________________________________________________
Sponsored Link

Mortgage rates near 39yr lows. $420k for $1,399/mo.
Calculate new payment!
www.LowerMyBills.com/lre


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net