public static void ReleaseInstance() { lock (singletonMutex) { if (referenceCount == 0) throw new Exception("No instances to remove!"); referenceCount--; if (referenceCount == 0) { liveSession.Dispose(); liveSession = null; simulateSet = false; } } return; }
public static ILiveSessionTtl CreateInstance(bool simulate_) { //NOTE: The COM class is configured for apartment threading which means it is slow (because of marshalling) to use instance if not the creating thread lock (singletonMutex) { if (referenceCount == 0) { //!!if (simulate_) // liveSession = new LiveSessionTtlSim(); //else liveSession = new LiveSessionTtl(); } referenceCount++; Simulate = simulate_; } return liveSession; }