private void SimulationLoop() { PacketSink sink = new DelegatePacketSink(OnResponse); while (RunSimulation) { Packet request; if (RequestQueue.TryDequeue(out request, 1)) { RouteAndDispatchRequest(request); } foreach (var device in Devices.Values) { device.OnTick(sink); } } }