public DispatchedCollection(object source, Action <object, NotifyCollectionChangedEventArgs> invoke) { _ncc = source as INotifyCollectionChanged; if (_ncc == null) { throw new Exception("source of DispatchedCollection has to implement INotifyCollectionChanged interface"); } _enumerable = source as IEnumerable <T>; if (_ncc == null) { throw new Exception("source of DispatchedCollection has to implement IEnumerable interface"); } _lockObject = source as ILock; if (_ncc == null) { throw new Exception("source of DispatchedCollection has to implement ILock interface"); } _invoke = invoke; _ncc.CollectionChanged += CollectionChangedEvent; }
public LockingEnumerator(IEnumerator <T> enumerator, ILock @lock) { _enumerator = enumerator; _lock = @lock; _lock.Lock(); }
private async Task HoldAndRenewAsync( ILock lockHandle, CancellationToken cancellationToken) { _log.TraceMethodEntry(); _hasLockSubject.OnNext(true); // however we keep in mind if the service bus dies // we can in theory lose the lock using (var lockHeldCancellationTokenSource = new CancellationTokenSource()) { var lockHeldCancellationToken = lockHeldCancellationTokenSource.Token; using (var loopAndRenewCancellationTokenSource = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken, lockHeldCancellationToken)) { var loopAndRenewCancellationToken = loopAndRenewCancellationTokenSource.Token; await LoopAndRenewAsync( lockHandle, loopAndRenewCancellationToken) .ConfigureAwait(false); } await lockHandle.ReleaseAsync() .ConfigureAwait(false); _hasLockSubject.OnNext(false); _hasLockSubject.OnCompleted(); } }
protected ProbabilisticMetadataIndexerBase(ILock fileLock, IAmazonAdapter amazonAdapter, TimeSpan lockTimeSpan, string bucketName) { _fileLock = fileLock; _amazonAdapter = amazonAdapter; _lockTimeSpan = lockTimeSpan; _bucketName = bucketName; }
public ILock Accquire(Func <bool> predicate) { ILock locker = null; if (predicate()) { @lock.Lock(); try { if (predicate()) { locker = @lock; } else { @lock.Dispose(); locker = @unlock; } } catch (Exception) { @lock.Dispose(); } } else { locker = @unlock; } return(locker); }
/// <summary> /// Initializes a new instance of the <see cref="ExtensionConnection"/> class. /// </summary> /// <param name="lockObject">An <see cref="ILock"/> object used to lock the mutex port before connection.</param> /// <param name="binary">The <see cref="FirefoxBinary"/> on which to make the connection.</param> /// <param name="profile">The <see cref="FirefoxProfile"/> creating the connection.</param> /// <param name="host">The name of the host on which to connect to the Firefox extension (usually "localhost").</param> public ExtensionConnection(ILock lockObject, FirefoxBinary binary, FirefoxProfile profile, string host) { this.profile = profile; if (binary == null) { this.process = new FirefoxBinary(); } else { this.process = binary; } lockObject.LockObject(this.process.TimeoutInMilliseconds); try { int portToUse = DetermineNextFreePort(host, profile.Port); profile.Port = portToUse; profile.UpdateUserPreferences(); this.process.Clean(profile); this.process.StartProfile(profile, null); SetAddress(host, portToUse); // TODO (JimEvans): Get a better url algorithm. executor = new HttpCommandExecutor(new Uri(string.Format(CultureInfo.InvariantCulture, "http://{0}:{1}/hub/", host, portToUse))); } finally { lockObject.UnlockObject(); } }
public async Task ProcessLockSameLockNameTestAsync() { ILockFactory processLockFactory = Init("Process").GetRequiredService <ILockFactory>(); List <Task> tasks = new List <Task>(); int sum = 0; string lockName = "ProcessLockSameLockNameTest"; for (int i = 0; i < 10000; i++) { Task t = Task.Run(async() => { using (ILock pLock = processLockFactory.GetLock(lockName)) { if (await pLock.WaitAsync()) { sum++; } } }); tasks.Add(t); } await Task.WhenAll(tasks.ToArray()); Assert.AreEqual(10000, sum); }
public object CreateProxy(IThreadSafeProxyFactory threadSafeProxyFactory, object obj, Type proxyType, Predicate<MethodInfo> methodIncluder, ILock theLock) { var typedFactoryCall = _typedFactoryCallProvider.GetTypedFactoryCall(proxyType); return typedFactoryCall.Invoke(threadSafeProxyFactory, obj, methodIncluder, theLock); }
/// <inheritdoc /> public async Task <LockResult> LockAsync(ILock l, CancellationToken cancellationToken) { ActiveLock newActiveLock; var destinationUrl = BuildUrl(l.Path); using (var transaction = await BeginTransactionAsync(cancellationToken)) { var locks = await transaction.GetActiveLocksAsync(cancellationToken); var status = Find(locks, destinationUrl, l.Recursive, true); var conflictingLocks = GetConflictingLocks(status, LockShareMode.Parse(l.ShareMode)); if (conflictingLocks.Count != 0) { if (_logger.IsEnabled(LogLevel.Information)) { _logger.LogInformation($"Found conflicting locks for {l}: {string.Join(",", conflictingLocks.GetLocks().Select(x => x.ToString()))}"); } return(new LockResult(conflictingLocks)); } newActiveLock = new ActiveLock(l, _rounding.Round(_systemClock.UtcNow), _rounding.Round(l.Timeout)); await transaction.AddAsync(newActiveLock, cancellationToken); await transaction.CommitAsync(cancellationToken); } OnLockAdded(newActiveLock); _cleanupTask.Add(this, newActiveLock); return(new LockResult(newActiveLock)); }
public void RemoveChild(ILock childLock) { lock (ChildLocksSync) { ChildLocks.Remove(childLock); } }
/// <summary> /// Initializes a new instance of the <see cref="ExtensionConnection"/> class. /// </summary> /// <param name="lockObject">An <see cref="ILock"/> object used to lock the mutex port before connection.</param> /// <param name="binary">The <see cref="FirefoxBinary"/> on which to make the connection.</param> /// <param name="profile">The <see cref="FirefoxProfile"/> creating the connection.</param> /// <param name="host">The name of the host on which to connect to the Firefox extension (usually "localhost").</param> public ExtensionConnection(ILock lockObject, FirefoxBinary binary, FirefoxProfile profile, string host) { this.profile = profile; if (binary == null) { this.process = new FirefoxBinary(); } else { this.process = binary; } lockObject.LockObject(this.process.TimeoutInMilliseconds); try { int portToUse = DetermineNextFreePort(host, profile.Port); profile.Port = portToUse; profile.UpdateUserPreferences(); this.process.Clean(profile); this.process.StartProfile(profile, null); SetAddress(host, portToUse); ConnectToBrowser(this.process.TimeoutInMilliseconds); } finally { lockObject.UnlockObject(); } }
public void DistributeLockShouldReleaseOnce() { ILockFactory processLockFactory = Init("Distribute").GetRequiredService <ILockFactory>(); string lockName = "ProcessLockSameLockNameTest"; bool getLock = true; List <Task> tasks = new List <Task>(); int sum = 0; for (int i = 0; i < 100; i++) { Task t = Task.Run(() => { using (ILock pLock = processLockFactory.GetLock(lockName)) { getLock = pLock.Wait(); if (getLock) { sum++; } pLock.Release(); } }); tasks.Add(t); } Task.WaitAll(tasks.ToArray()); Assert.AreEqual(100, sum); }
public async Task DistributeLockDifferentLockNameTestAsync() { ILockFactory processLockFactory = Init("Distribute").GetRequiredService <ILockFactory>(); List <Task> tasks = new List <Task>(); int sum = 0; for (int i = 0; i < 10000; i++) { Task t = Task.Run(async() => { using (ILock pLock = processLockFactory.GetLock(Guid.NewGuid().ToString())) { if (await pLock.WaitAsync()) { sum++; } } }); tasks.Add(t); } await Task.WhenAll(tasks.ToArray()); Assert.AreNotEqual(10000, sum); }
public CacheHandler( TProvider cacheProvider, ILock cacheLock) { Provider = cacheProvider != null ? cacheProvider : throw new ArgumentNullException(nameof(cacheProvider)); _cacheLock = cacheLock ?? throw new ArgumentNullException(nameof(cacheLock)); }
/// <summary> /// Creates a critical section autolocker /// </summary> /// <param name="lockObject">LockableCS object to lock</param> /// <returns>AutoLockT< ILock > object</returns> public static AutoLockT <ILock> LockToWrite(ILock lockObject, int timeout) { var csLock = lockObject as CriticalSectionAutoLock; if (csLock != null) { return(new AutoLockT <ILock>(lockObject)); } var mutexLock = lockObject as MutexAutoLock; if (mutexLock != null) { return(new AutoLockT <ILock>(lockObject, timeout)); } var readerWriterLock = lockObject as ReaderWriterAutoLock; if (readerWriterLock != null) { return(new AutoLockT <ILock>(lockObject, LockType.Write, timeout)); } throw new Exception("Invalid lock object"); }
private static long CheckMutualExclusion(ILock @lock, int count, int cyclesCount) { var buckets = new long[count]; var finished = new bool[count]; var total = 0L; ThreadId.ZeroOut(); var threads = Enumerable.Range(0, count).Select(i => { return(new Thread(() => { for (var j = 0; j < cyclesCount; j++) { @lock.Lock(); buckets[i]++; total++; @lock.Unlock(); } finished[i] = true; })); }); foreach (var thread in threads) { thread.Start(); } while (finished.Any(f => !f)) { } return(total); }
/// <summary> /// Initializes a new instance of the <see cref="ExtensionConnection"/> class. /// </summary> /// <param name="lockObject">An <see cref="ILock"/> object used to lock the mutex port before connection.</param> /// <param name="binary">The <see cref="FirefoxBinary"/> on which to make the connection.</param> /// <param name="profile">The <see cref="FirefoxProfile"/> creating the connection.</param> /// <param name="host">The name of the host on which to connect to the Firefox extension (usually "localhost").</param> public ExtensionConnection(ILock lockObject, FirefoxBinary binary, FirefoxProfile profile, string host) { this.profile = profile; if (binary == null) { this.process = new FirefoxBinary(); } else { this.process = binary; } lockObject.LockObject(this.process.TimeoutInMilliseconds); try { int portToUse = DetermineNextFreePort(host, profile.Port); profile.Port = portToUse; profile.UpdateUserPreferences(); this.process.Clean(profile); this.process.StartProfile(profile, null); this.SetAddress(host, portToUse); // TODO (JimEvans): Get a better url algorithm. this.executor = new HttpCommandExecutor(new Uri(string.Format(CultureInfo.InvariantCulture, "http://{0}:{1}/hub/", host, portToUse))); } finally { lockObject.UnlockObject(); } }
public void ReleaseTableWriteLock(ITable table, Transaction transaction) { if (transaction.IsolationLevel == IsolationLevels.ReadCommited || transaction.IsolationLevel == IsolationLevels.RepetableRead) { return; } ILock tableLock = this.tableLocks[table]; var lockInfo = this.lockInventory.GetLockInformation(tableLock, transaction); if (lockInfo.IsWriteLockHeld) { if (lockInfo.IsReadLockHeld) { tableLock.Downgrade(); } else { tableLock.ExitWrite(); // TODO: OnReleased } lockInfo.IsWriteLockHeld = false; } }
internal ClientConductor(Aeron.Context ctx) { _ctx = ctx; _clientLock = ctx.ClientLock(); _epochClock = ctx.EpochClock(); _nanoClock = ctx.NanoClock(); _driverProxy = ctx.DriverProxy(); _logBuffersFactory = ctx.LogBuffersFactory(); _keepAliveIntervalNs = ctx.KeepAliveInterval(); _driverTimeoutMs = ctx.DriverTimeoutMs(); _driverTimeoutNs = _driverTimeoutMs * 1000000; _interServiceTimeoutNs = ctx.InterServiceTimeout(); _defaultAvailableImageHandler = ctx.AvailableImageHandler(); _defaultUnavailableImageHandler = ctx.UnavailableImageHandler(); _availableCounterHandler = ctx.AvailableCounterHandler(); _unavailableCounterHandler = ctx.UnavailableCounterHandler(); _driverEventsAdapter = new DriverEventsAdapter(ctx.ToClientBuffer(), this); _counterValuesBuffer = ctx.CountersValuesBuffer(); _countersReader = new CountersReader(ctx.CountersMetaDataBuffer(), ctx.CountersValuesBuffer(), Encoding.ASCII); long nowNs = _nanoClock.NanoTime(); _timeOfLastKeepAliveNs = nowNs; _timeOfLastResourcesCheckNs = nowNs; _timeOfLastServiceNs = nowNs; }
internal ClientConductor(Aeron.Context ctx) { _ctx = ctx; _clientLock = ctx.ClientLock(); _epochClock = ctx.EpochClock(); _nanoClock = ctx.NanoClock(); _errorHandler = ctx.ErrorHandler(); _counterValuesBuffer = ctx.CountersValuesBuffer(); _driverProxy = ctx.DriverProxy(); _logBuffersFactory = ctx.LogBuffersFactory(); _imageMapMode = ctx.ImageMapMode(); _keepAliveIntervalNs = ctx.KeepAliveInterval(); _driverTimeoutMs = ctx.DriverTimeoutMs(); _driverTimeoutNs = _driverTimeoutMs * 1000000; _interServiceTimeoutNs = ctx.InterServiceTimeout(); _publicationConnectionTimeoutMs = ctx.PublicationConnectionTimeout(); _driverListener = new DriverListenerAdapter(ctx.ToClientBuffer(), this); _driverAgentInvoker = ctx.DriverAgentInvoker(); long nowNs = _nanoClock.NanoTime(); _timeOfLastKeepaliveNs = nowNs; _timeOfLastCheckResourcesNs = nowNs; _timeOfLastWorkNs = nowNs; }
public WorkItemContext(JobQueueEntryContext <WorkItemData> context, object data, string jobId, ILock workItemLock, Func <int, string, Task> progressCallback) : base(context.QueueEntry, context.QueueEntryLock, context.CancellationToken) { Data = data; JobId = jobId; WorkItemLock = workItemLock; _progressCallback = progressCallback; }
public ThreadSafeInterceptor(ILock theLock, Predicate<MethodInfo> methodIncluder, ILockController lockController) { if (theLock == null) { throw new ArgumentNullException("theLock"); } if (methodIncluder == null) { throw new ArgumentNullException("methodIncluder"); } if (lockController == null) { throw new ArgumentNullException("lockController"); } if (!lockController.CanControl(theLock)) { throw new ArgumentException(ExceptionMessages.LockNotSupportedByLockController, "lockController"); } _lock = theLock; _lockController = lockController; _methodIncluder = methodIncluder; }
public ThreadSafeInterceptor(ILock theLock, Predicate <MethodInfo> methodIncluder, ILockController lockController) { if (theLock == null) { throw new ArgumentNullException("theLock"); } if (methodIncluder == null) { throw new ArgumentNullException("methodIncluder"); } if (lockController == null) { throw new ArgumentNullException("lockController"); } if (!lockController.CanControl(theLock)) { throw new ArgumentException(ExceptionMessages.LockNotSupportedByLockController, "lockController"); } _lock = theLock; _lockController = lockController; _methodIncluder = methodIncluder; }
public FifoReadWriteLock() { readAcquires = readReleases = 0; writer = false; readLock = new ReadLock(this); writeLock = new WriteLock(this); }
public void DistributeLockShouldTimeout() { ILockFactory processLockFactory = Init("Distribute").GetRequiredService <ILockFactory>(); string lockName = "ProcessLockSameLockNameTest"; bool getLock = true; List <Task> tasks = new List <Task>(); for (int i = 0; i < 2; i++) { Task t = Task.Run(() => { using (ILock pLock = processLockFactory.GetLock(lockName)) { getLock = pLock.Wait(TimeSpan.FromSeconds(1)); if (getLock) { System.Threading.Thread.Sleep(3000); } } }); tasks.Add(t); } Task.WaitAll(tasks.ToArray()); Assert.IsFalse(getLock); using (ILock pLock = processLockFactory.GetLock(lockName)) { getLock = pLock.Wait(TimeSpan.FromSeconds(3)); } Assert.IsTrue(getLock); }
internal ClientConductor(Aeron.Context ctx) { _clientLock = ctx.ClientLock(); _epochClock = ctx.EpochClock(); _nanoClock = ctx.NanoClock(); _errorHandler = ctx.ErrorHandler(); _counterValuesBuffer = ctx.CountersValuesBuffer(); _driverProxy = ctx.DriverProxy(); _logBuffersFactory = ctx.LogBuffersFactory(); _imageMapMode = ctx.ImageMapMode(); _keepAliveIntervalNs = ctx.KeepAliveInterval(); _driverTimeoutMs = ctx.DriverTimeoutMs(); _driverTimeoutNs = _driverTimeoutMs * 1000000; _interServiceTimeoutNs = ctx.InterServiceTimeout(); _publicationConnectionTimeoutMs = ctx.PublicationConnectionTimeout(); _defaultAvailableImageHandler = ctx.AvailableImageHandler(); _defaultUnavailableImageHandler = ctx.UnavailableImageHandler(); _driverEventsAdapter = new DriverEventsAdapter(ctx.ToClientBuffer(), this); long nowNs = _nanoClock.NanoTime(); _timeOfLastKeepAliveNs = nowNs; _timeOfLastResourcesCheckNs = nowNs; _timeOfLastServiceNs = nowNs; }
public void AddChild(ILock childLock) { lock (ChildLocksSync) { ChildLocks.AddIfNotNull(childLock); } }
public virtual void SetReferences(IReferences references) { _metricsService = references.GetOneRequired <ICosmosDbMetricsService>(new Descriptor("pip-services3", "metrics-service", "*", "*", "*")); _lock = references.GetOneRequired <ILock>(new Descriptor("pip-services3", "lock", "*", "*", "*")); _logger.SetReferences(references); }
public WorkItemContext(object data, string jobId, ILock workItemLock, CancellationToken cancellationToken, Func <int, string, Task> progressCallback) { Data = data; JobId = jobId; WorkItemLock = workItemLock; CancellationToken = cancellationToken; _progressCallback = progressCallback; }
void Unlock() { for (int l = 0; l < attachedLocks.Count; l++) { ILock levelLock = attachedLocks[l].GetComponent <ILock>(); levelLock.UnlockLand(syncKey); } }
public Door(int id, string location, ILock doorLock) { this.id = id; this.location = location; this.doorLock = doorLock; logs = new List <Log>(); users = new List <User>(); }
public void Unlock([NotNull] ILock locker) => Locker.RunLocking(() => { counter -= 1; if (counter == 0) { locker.Unlock(); } });
public void Lock([NotNull] ILock locker) => Locker.RunLocking(() => { counter += 1; if (counter == 1) { locker.Lock(); } });
public SillyWebServer(WebServerOptions options) { _options = options ?? throw new ArgumentNullException(nameof(options)); _listener = new HttpListener(); _thread = new Thread(Listen); _lock = new MonitorLock((_handleThreads as ICollection).SyncRoot); _listener.Prefixes.Add($"http://{_options.Host}:{_options.Port}/"); }
public AmazonRootIndexFileAccess(IRootIndexCache cache, IAmazonAdapter amazonAdapter, ILock lockMechanism, AmazonRootIndexFileConfiguration configuration) { _cache = cache; _amazonAdapter = amazonAdapter; _lockMechanism = lockMechanism; _lockTimeSpan = TimeSpan.FromSeconds(configuration.LockTimeSpanInSeconds); _bucketName = configuration.BucketName; _rootIndexName = $"{CommonKeys.INDEX_FOLDER_NAME}/{configuration.RootIndexName}"; }
public void Unlock(ILock _lock) { if (_lock != this._lock) { throw new ArgumentException("Invalid lock used to unlock", "_lock"); } Monitor.Exit(_lock.Sync); this._lock = null; }
public void Exit(ILock theLock) { if (CanControlWithoutChaining(theLock)) { ExitWithoutChaining(theLock); } else { if (_next == null) { throw new ArgumentException(ExceptionMessages.LockNotSupportedByLockController, "theLock"); } _next.Exit(theLock); } }
public void Enter(ILock theLock, ref bool lockTaken) { if (CanControlWithoutChaining(theLock)) { EnterWithoutChaining(theLock, ref lockTaken); } else { if (_next == null) { throw new ArgumentException(ExceptionMessages.LockNotSupportedByLockController, "theLock"); } _next.Enter(theLock, ref lockTaken); } }
private static void InnerTest(ILock mySpinLock) { ThreadPool.QueueUserWorkItem( o => { int copy1, copy2; using (mySpinLock.EnterAndReturnLock()) { copy1 = _spinLockTest1Counter; _spinLockTest1Counter++; copy2 = _spinLockTest1Counter; } Assert.IsTrue(copy1 + 1 == copy2); } ); }
// TODO: Reimagine public Item GetLockInformation(ILock l, Transaction transaction) { var set = this.GetLocks(transaction); // TODO: Perf var lockInfo = set.FirstOrDefault(x => x.Lock.Equals(l)); if (lockInfo != null) { return lockInfo; } else { var newLockInfo = new Item(l); set.Add(newLockInfo); return newLockInfo; } }
public frmMain( IShowListForCities showListForCities, IShowListForDrivers showListForDrivers, IShowListForFreights showListForFreights, IShowListForReports showListForReports, IShowListForSubReports showListForSubReports, IShowListForPeople showListForPeople, IShowListForTransferForms showListForTransferForms, IShowListForCheckBanks showListForCheckBanks, ILock lLock ) { _showListForCities = showListForCities; _showListForDrivers = showListForDrivers; _showListForFreights = showListForFreights; _showListForReports = showListForReports; _showListForSubReports = showListForSubReports; _showListForPeople = showListForPeople; _showListForTransferForms = showListForTransferForms; _showListForCheckBanks = showListForCheckBanks; _lLock = lLock; _dateTime = DateTime.Now.AddMinutes(-1); InitializeComponent(); CriudEvent += frmMain_CriudEvent; Activated += (s, e) => messageCenterGroup.Visible = false; _digitalImages = new Image[] { Properties.Resources.num0, Properties.Resources.num1, Properties.Resources.num2, Properties.Resources.num3, Properties.Resources.num4, Properties.Resources.num5, Properties.Resources.num6, Properties.Resources.num7, Properties.Resources.num8, Properties.Resources.num9, }; }
public Program(string[] input) { //assign input params lockType = int.Parse(input[0]); lowInc = int.Parse(input[1]); highEx = int.Parse(input[2]); nThreads = int.Parse(input[4]); modulus = int.Parse(input[3]); mode = int.Parse(input[5]); //calcualte intervals intervals = CalcIntervals(); //select lock type if (lockType == 0) locker = new TaSLock(); else if (lockType == 1) locker = new TTaSLock(); else locker = new mySpinLock(); //select mode if (mode == 0) { StartThreads(CountMode); Console.WriteLine(counter); } else if (mode == 1) { StartThreads(ListMode); } else if (mode == 2) { hash = input[6]; StartThreads(SearchMode); if (!foundIt) Console.WriteLine(-1); } }
public AsyncAction(string name, Action<CancellationToken> cancellableActionToExecute) { Lock = LockFactory.Current.CreateLock(name); this.CancellableActionToExecute = cancellableActionToExecute; }
protected override void EnterWithoutChaining(ILock theLock, ref bool lockTaken) { theLock.Enter(); lockTaken = true; }
public abstract object Invoke(IThreadSafeProxyFactory threadSafeProxyFactory, object obj, Predicate<MethodInfo> methodIncluder, ILock theLock);
protected abstract void ExitWithoutChaining(ILock theLock);
protected override bool CanControlWithoutChaining(ILock theLock) { return true; }
protected override bool CanControlWithoutChaining(ILock theLock) { return theLock is ISafeFailingLock; }
public void Setup() { l = Client.GetLock(TestSupport.RandomString()); }
private PubSub(LockType lockType) { _lock = LockFactory.Create(lockType); }
protected override void EnterWithoutChaining(ILock theLock, ref bool lockTaken) { (theLock as ISafeFailingLock).Enter(ref lockTaken); }
protected override void ExitWithoutChaining(ILock theLock) { theLock.Exit(); }
public Item(ILock l) { this.Lock = l; }
public JobRunContext(ILock jobLock, CancellationToken cancellationToken = default(CancellationToken)) { JobLock = jobLock; CancellationToken = cancellationToken; }
public AsyncAction(string name, Action actionToExecute) { Lock = LockFactory.Current.CreateLock(name); this.ActionToExecute = actionToExecute; }
public JobContext(CancellationToken cancellationToken, ILock lck = null) { Lock = lck; CancellationToken = cancellationToken; }
public IInterceptor CreateInterceptor(ILock theLock, Predicate<MethodInfo> methodIncluder) { return new ThreadSafeInterceptor(theLock, methodIncluder, _lockControllerFactory()); }
public ThreadSafeInterceptor(ILock theLock, Predicate<MethodInfo> methodIncluder) : this(theLock, methodIncluder, StandardImplementations.CreateLockController()) { }
private void LockAquired(ILock l, Transaction transaction) { this.lockGraph.RemoveConnection(transaction, l); this.lockGraph.AddConnection(l, transaction); }
private void WaitsFor(ILock l, Transaction transaction) { this.lockGraph.AddConnection(transaction, l); if (this.lockGraph.HasCycle()) { // Deadlock detection throw new DeadlockException(); } }