public void Shutdown() { _logger.Warn("TaskManager shutting down!"); if (!_started || _shuttingDown) { return; } // Set flags _shuttingDown = true; _started = false; // Stop publishing events _eventLoop.Stop(true); // Stop all tasks foreach (var _task in _tasks) { _task.Value.Stop(brutalKill: true); } }