Beispiel #1
0
    public void DoDelegatedWork()
    {
        List <Action> local = null;

        lock (DelegatedWork) {
            if (DelegatedWork.Count > 0)
            {
                local = new List <Action>(DelegatedWork);
                DelegatedWork.Clear();
            }
        }
        if (local != null)
        {
            foreach (Action action in local)
            {
                action.Invoke();
            }
        }
    }
Beispiel #2
0
 private void DelegateWork(Action action)
 {
     lock (DelegatedWork) {
         DelegatedWork.Add(action);
     }
 }