Boost logo

Boost Users :

From: Geert Pante (geertpante_at_[hidden])
Date: 2004-02-12 08:57:50


There's nothing wrong with your runnable class, but with your use of
thread::join(). Boost::threads start as soon as they are constructed,
join() means: wait until they are finished.

In your test code, it doesn't make sense to join() your threads before you
Stop() them. Probably the next is what you meant:

        Threading::boost_thread_starter starter3((Threading::Runnable
*)&writer2);
        boost::thread* _writer_thread2 = new boost::thread(starter3);

        // pause for 5 secs
        boost::xtime xt;
    boost::xtime_get(&xt, boost::TIME_UTC);
    xt.sec += 5;
    boost::thread::sleep(xt);

        writer2.Stop();

        _writer_thread2->join();

Cya, Geert.


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