D Mutex reference.

Frits van Bommel fvbommel at REMwOVExCAPSs.nl
Fri Jan 19 04:16:05 PST 2007


Saaa wrote:
> I'm not really doing OOP, or am I reading it incorrectly again?
> What is the object reference?
> I just use a simple (never-ending)  function for the data generation.
> Should I just encapsulate this function in synchronize?

You could always allocate an object just for this purpose.

Something like this:
-----
Object lock;

static this() { lock = new Object; }

void foo() {
   synchronized(lock) {
     // ...
   }
}

void bar() {
   synchronized(lock) {
     // ...
   }
}
-----


More information about the Digitalmars-d-learn mailing list