Synchronizing on Termination

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
%% synchronize on termination of all 3 threads
{Wait X3}