|
Boost : |
From: Peter Dimov (pdimov_at_[hidden])
Date: 2001-08-13 09:46:01
From: "Scott McCaskill" <scott_at_[hidden]>
> > For instance, what is the boost.threads way to do the following:
> >
> > void thread_function()
> > {
> > init();
> >
> > for(;;)
> > {
> > waitForMultipleEvents(wakeup_event, terminate_event);
> > if(terminate_event signalled) break;
> > do_work();
> > }
> >
> > cleanup();
> > }
> >
>
> How about this:
>
> boost::mutex theMutex;
> boost::condition theCondition;
> volatile bool terminateFlag = false;
> volatile bool wakeupFlag = false;
[code snipped]
OK, but why is this better than the event-based solution? IOW what is the
rationale for the added complexity?
-- Peter Dimov Multi Media Ltd.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk