public void TaskTest() { Assert.AreEqual(5, loop.QueueWait((MainLoopJob) delegate { return(5); }), "#1"); ManualResetEvent handle = new ManualResetEvent(false); loop.QueueWait((MainLoopTask) delegate { handle.Set(); }); Assert.IsTrue(handle.WaitOne(5000, true), "#2"); }
public void TaskTest() { Assert.Equal(5, loop.QueueWait((MainLoopJob) delegate { return(5); })); ManualResetEvent handle = new ManualResetEvent(false); loop.QueueWait((MainLoopTask) delegate { handle.Set(); }); #if NETSTANDARD1_5 Assert.True(handle.WaitOne(5000), "#2"); #else Assert.True(handle.WaitOne(5000, true), "#2"); #endif }
public void Dispose() { if (disposed) { return; } disposed = true; // FIXME: Ensure everything is written to disk before killing the mainloop. IOLoop.QueueWait((MainLoopTask)writer.Dispose); }
public void Dispose() { if (disposed) { return; } disposed = true; MainLoop.QueueWait((MainLoopTask) delegate { this.dhtEngine.Dispose(); this.diskManager.Dispose(); this.listenManager.Dispose(); this.localPeerListener.Stop(); this.localPeerManager.Dispose(); }); }