protected void WaitForMessage()
{
try
{
lock(semaphore)
{
Monitor.Wait(semaphore, 2000);
}
}
catch(ThreadInterruptedException)
{
Thread.CurrentThread.Interrupt();
}
}