public static void Install() { // make sure TPL installs its own event source Task.Factory.StartNew(() => { }, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default); var local = new TPLListener(); Interlocked.CompareExchange(ref s_listener, local, null); }
public static void Install() { // make sure TPL installs its own event source Task.Factory.StartNew(() => { }); var local = new TPLListener(); Interlocked.CompareExchange(ref s_listener, local, null); }
public static void Uninstall() { TPLListener local = null; Interlocked.Exchange(ref local, s_listener); if (local != null) { local.Dispose(); } }