What sync object should i use?

Sean Kelly sean at invisibleduck.org
Tue May 14 11:13:13 PDT 2013


On May 14, 2013, at 10:59 AM, Heinz <thor587 at gmail.com> wrote:

> Guys, this is a precise example of what i'm trying to do. You'll notice that there're 2 ways of waking up the consumer:
> 
> /////////////////////////////////////////////////////////////////////
> Condition cond; // Previously instantiated.
> bool loop = false; // This variable determine if the consumer should take the next iteration or wait until a thread calls SetLoop(true).
> Object my_variable; // A value used for comunicating producer and consumer. It's not a prerequisite to be set for an iteration to happen.

Let's back up a minute.  Can you be more specific about what you're trying to do?  I think you shouldn't need to use the "loop" var at all, but I'm not entirely sure.  Also, loop and my_variable will be thread-local given how they're declared.


More information about the Digitalmars-d-learn mailing list