- Problem: given n threads, we would like to know when they have all
terminated
- Solution: the short-circuit technique
The idea is to pass a token indicating thread termination from thread
to thread until it has passed through all threads:
declare X0 X1 X2 X3
X0 = unit
thread ... X1=X0 end
thread ... X2=X1 end
thread ... X3=X2 end
{Wait X3}