Boost logo

Boost Users :

Subject: [Boost-users] thread problem
From: Kraus Philipp (philipp.kraus_at_[hidden])
Date: 2010-11-27 12:01:55


Hello,

I have some problems with a thread call. I have a call with a method
in that should create a thread:

void myclass::mymethod( void )
{
  boost::thread l_thread( boost::bind( &myclass::threadrun, this ) );
  l_thread.join(); <= this blocks
}

My threadrun method shows:

void myclass:threadrun( void )
{
   while (m_listenerrunnging) {
            boost::this_thread::yield();
    }
}

The join starts the threadrun method but it blocks the main run. I
have got a class which should create only one thread (in itsself),
that should run until the class is destroyed. The threadrun method
reads some data at a network device in asychron calls, so the
threadrun can sleep during running.
How can I do this in a correct way?

Thx

Phil



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