|
Boost Users : |
Subject: Re: [Boost-users] Creating a thread and blocking its execution
From: Jean-Sebastien Stoezel (js.stoezel_at_[hidden])
Date: 2010-08-31 17:06:54
Hello,
Thanks for advice and the quick reply.
Jean-Sebastien
On Tue, Aug 31, 2010 at 2:14 PM, Christoph Heindl <
christoph.heindl_at_[hidden]> wrote:
> On Tue, Aug 31, 2010 at 7:31 PM, Jean-Sebastien Stoezel
> <js.stoezel_at_[hidden]> wrote:
> > I would like to create a thread from this initialization method, and wait
> > for it to execute until the whole initialization process it done.
>
> I would use a condition variable plus a boolean state (a primitive
> event) that is passed to the thread-function upon creation (utilizing
> boost::bind). thread waits for the condition to be signaled. the
> initialization routine updates the state and notifies the condition
> upon completion.
>
> If you need this pattern frequently, I'd suggest to extract that logic
> from CSubsystem::TaskWrapper into common class.
>
> Best regards,
> Christoph
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>
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