static void MonitorIpcServer() { using (_ipcServer) { while (_keepAlive) { Msg receivedMsg = new Msg(); // Wait 500ms before timing out. Give the processor some time to do other things try { if (!_ipcServer.TryReceive(ref receivedMsg, new TimeSpan(0, 0, 0, 0, 500 /*millis*/))) { continue; } } catch { Thread.Sleep(100); continue; } // TODO } } }