int NUM_THREADS = 10;

Condition cond;

cond.create(true); // manual reset

function MyThreadEntry(local Thread t) {
   trace "begin MyThreadEntry";
   cond.wait(0);
   trace "end MyThreadEntry";
}

PointerArray threads;
Thread t;

// Create threads
loop(NUM_THREADS)
{
   t <= new Thread;
   t.create(MyThreadEntry);
   threads.add(#(deref t));
}

TKS.sleep(500);
trace "raise condition";
cond.raise();

// Join threads
foreach t in threads {
   t.wait();
}

cond.reset();

trace "cu";