public static async Task processController(WorkloadController controller) { source = new CancellationTokenSource(); source.Token.Register(CancelNotification); var completionSource = new TaskCompletionSource <object>(); source.Token.Register(() => completionSource.TrySetCanceled()); var task = Task.Factory.StartNew(() => controller.Run(), source.Token); await Task.WhenAny(task, completionSource.Task); }
public ServerStateManager(WorkloadController workloadController, string pipeName = "GameServer") { this.workloadController = workloadController; this.NamedPipeName = pipeName; }