Ejemplo n.º 1
0
        public override void Unlock(LockContextMode mode)
        {
            if (mode == LockContextMode.Read)
            {
                if (Interlocked.Increment(ref this.clearReadLocks) == 1)
                {
                    lock (this)
                    {
                        foreach (var keyLock in this.lockRequests)
                        {
                            while (keyLock.Count > 0 && keyLock.Mode == LockMode.Shared)
                            {
                                keyLock.LockManager.ReleaseLock(keyLock);
                            }
                        }

                        return;
                    }
                }
            }
            else
            {
                Diagnostics.Assert(mode == LockContextMode.Write, this.tracer, "Inavlid lock mode {0}", mode);

                // Release all locks.
                this.Dispose();
            }
        }
        /// <summary>
        /// Releases the lock and cleans up transient state.
        /// </summary>
        public override void Unlock(LockContextMode mode)
        {
            AppTrace.TraceSource.WriteInfo(
                "StateManager.StateManagerTransactionContext.Unlock",
                "unlock called for tansaction {0}",
                this.TransactionId);

            this.LockContext.Unlock(this);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Adds a lock context.
        /// </summary>
        /// <param name="lockContext">
        /// The lock context.
        /// </param>
        /// <param name="lockMode">
        /// Mode of the lock.
        /// For committing transaction read locks are released before IO.
        /// </param>
        public void AddLockContext(LockContext lockContext, LockContextMode lockMode = LockContextMode.Write)
        {
            if (lockContext == null)
            {
                throw new ArgumentNullException(
                          string.Format(CultureInfo.CurrentCulture, SR.Error_NullArgument_Formatted, "lockContext"));
            }

            if (lockMode == LockContextMode.Write)
            {
                this.LockContexts.Add(lockContext);
            }
            else
            {
                this.AddReadLock(lockContext);
            }
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Propagates a wave if needed.
 /// </summary>
 public override void Unlock(LockContextMode mode)
 {
     Task.Factory.StartNew(async() => { await this.waveController.ResumeWavePropagation(this.waveId, this.outboundStreams, this.replicatorTransaction); });
 }
Ejemplo n.º 5
0
 public override void Unlock(LockContextMode mode)
 {
     this.queue.Unlock(this);
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Releases locks.
 /// </summary>
 public virtual void Unlock(LockContextMode mode)
 {
     this.lockManager.Unlock(this);
 }
 public override void Unlock(LockContextMode mode)
 {
     // todo: release this sooner (if possible) once #6433142 is fixed
     this.primeLock.ReleaseWriteLock();
 }