Take a look at p.72 of the book. Or simply insert
Code:
private void Wait(int millissec)
{
//instead of:
//Thread.Sleep(millisec);
//use this (see p.72 of the book)
AutoResetEvent signal = newAutoResetEvent(false);
Activate(
Arbiter.Receive(
false,
TimeoutPort(millisec),
delegate(DateTime timeout)
{
signal.Set();
}
)
);
signal.WaitOne();
}