示例#1
0
            internal static void Finish(SecurityActivity activity)
            {
                lock (_waitingSetLock)
                {
                    // activity is done in the ActivityQueue
                    _waitingSet.Remove(activity);

                    // terminate and release waiting threads if there is any.
                    activity.Finish();

                    // register activity termination in the log.
                    SecurityActivityHistory.Finish(activity.Id);

                    // register activity termination.
                    TerminationHistory.FinishActivity(activity);

                    // execute all activities that are completely freed.
                    foreach (var dependentItem in activity.WaitingForMe.ToArray())
                    {
                        dependentItem.FinishWaiting(activity);
                        if (dependentItem.WaitingFor.Count == 0)
                        {
                            Task.Run(() => Executor.Execute(dependentItem));
                        }
                    }
                }
            }
示例#2
0
 internal static void AttachOrFinish(SecurityActivity activity)
 {
     lock (_waitingSetLock)
     {
         var sameActivity = _waitingSet.FirstOrDefault(a => a.Id == activity.Id);
         if (sameActivity != null)
         {
             sameActivity.Attach(activity);
             SnTrace.SecurityQueue.Write("SAQ: SA{0} attached to another in the waiting set.", activity.Id);
             return;
         }
     }
     activity.Finish(); // release blocked thread
     SecurityActivityHistory.Finish(activity.Id);
     SnTrace.SecurityQueue.Write("SAQ: SA{0} ignored: finished but not executed.", activity.Id);
 }