Пример #1
0
 public void WaitAndRelease(int completionCount)
 {
     CoreException.Assert(Continuation == null, "Can't use WaitAndRelease while also using a continuation");
     for (; ;)
     {
         var comp = Volatile.Read(ref m_numCompleted);
         if (comp >= completionCount)
         {
             break;
         }
         Thread.Sleep(0);
     }
     JobCompletion.Release(this);
 }
Пример #2
0
        internal void IncrementCompleted()
        {
            int cac          = ContinuationAtCount;
            var numCompleted = Interlocked.Increment(ref m_numCompleted);

            if (numCompleted == cac && Continuation != null)
            {
                using (new Timing(ContinuationName == null ? "continuation" : ContinuationName))
                {
                    var post    = Continuation;
                    var postArg = ContinuationArgument;
                    JobCompletion.Release(this);
                    post(postArg);
                }
            }
        }