private void UnRegister() { lock (this) { if (this.registrar != null) { if (this.workerThreadInitialized) { this.alive = false; this.doIndicate.Set(); GC.KeepAlive(this); this.workerThreadInitialized = false; } this.registrar.UnRegister_(); this.registrar = null; } } }
void UnRegister() { lock (this) { // Only unregister one time if (registrar == null) { return; } // Kill worker thread if (lengthFromSTA != -1) { alive = false; SetEvent(hDoIndicate); // doIndicate.Set(); } registrar.UnRegister_(); registrar = null; } }
public EventSource(string namespaceName, string appName, InstrumentedAssembly instrumentedAssembly) { this.registrar = (IWbemDecoupledRegistrar)(new WbemDecoupledRegistrar()); this.reqList = new ArrayList(3); this.critSec = new object(); this.doIndicate = new AutoResetEvent(false); this.alive = true; this.mapQueryIdToQuery = new Hashtable(); lock (EventSource.eventSources) { if (EventSource.shutdownInProgress == 0) { this.instrumentedAssembly = instrumentedAssembly; int num = this.registrar.Register_(0, null, null, null, namespaceName, appName, this); if (num != 0) { Marshal.ThrowExceptionForHR(num); } EventSource.eventSources.Add(this); } } }
void UnRegister() { lock (this) { // Only unregister one time if (registrar == null) { return; } // Kill worker thread if (workerThreadInitialized == true) { alive = false; doIndicate.Set(); // SetEvent(hDoIndicate); GC.KeepAlive(this); workerThreadInitialized = false; } registrar.UnRegister_(); registrar = null; } }
void UnRegister() { lock(this) { // Only unregister one time if(registrar == null) return; // Kill worker thread if(workerThreadInitialized == true) { alive = false; doIndicate.Set(); // SetEvent(hDoIndicate); GC.KeepAlive(this); workerThreadInitialized = false; } registrar.UnRegister_(); registrar = null; } }