public static InProcListener GetListener(string aPath) { InProcListener Result; fLock.AcquireReaderLock(0x7fffffff); try { if (!fQueue.TryGetValue(aPath, out Result)) { LockCookie lCookie = fLock.UpgradeToWriterLock(0x7fffffff); try { if (!fQueue.TryGetValue(aPath, out Result)) { Result = new InProcListener(aPath); fQueue.Add(aPath, Result); } } finally { fLock.DowngradeFromWriterLock(ref lCookie); } } Result.AddRef(); } finally { fLock.ReleaseReaderLock(); } return(Result); }
public static void ReleaseListener(InProcListener aRef) { fLock.AcquireReaderLock(0x7fffffff); try { aRef.RemoveRef(); } finally { fLock.ReleaseReaderLock(); } }
public static void RemoveListener(string aPath, Action <object> aListener) { InProcListener lWork; fLock.AcquireWriterLock(0x7fffffff); try { if (!fQueue.TryGetValue(aPath, out lWork)) { lWork = new InProcListener(aPath); fQueue.Add(aPath, lWork); } } finally { fLock.ReleaseWriterLock(); } lock (lWork) lWork.Remove(aListener); }
public static InProcListener AddListener(string aPath, Action <object> aListener) { InProcListener Result; fLock.AcquireWriterLock(0x7fffffff); try { if (!fQueue.TryGetValue(aPath, out Result)) { Result = new InProcListener(aPath); fQueue.Add(aPath, Result); } } finally { fLock.ReleaseWriterLock(); } lock (Result) Result.AddLast(aListener); return(Result); }
public override void Dispose() { InProcServer.ReleaseListener(this.fChannel); this.fChannel = null; }
public InProcSend(InProcListener aChannel) { this.fChannel = aChannel; }
public InProcReceive(InProcQueue aOwner, string aName) { this.fMessages = new LinkedList <object>(); this.fOwner = aOwner; this.fChannel = InProcServer.AddListener(aName, new Action <object>(this.Callback)); }