Esempio n. 1
0
 private void UpdateMyThread(NutBagOperation <T> op)
 {
     if (op.op == OperationEnum.Delete)
     {
         _threadLocalList.Remove(op.data);
     }
     if (op.op == OperationEnum.Insert)
     {
         _threadLocalList.Add(op.data);
     }
 }
Esempio n. 2
0
        //ConcurrentBag<NutBagOperation<T>> GetMyOpBag()
        //{
        //    CheckNewWorkerThread();
        //    if (workerThreadUpdates.Count() >= _threadID + 1) return workerThreadUpdates.ElementAt(_threadID);
        //    return null;
        //}

        private void DoDelete(T data)
        {
            CheckNewWorkerThread();
            CheckForUpdates();
            for (int i = 0; i < nextThreadID; i++)
            {
                if (i == _threadID)
                {
                    continue;
                }
                var op = new NutBagOperation <T>(OperationEnum.Delete, data, i);
                workerThreadUpdates.Enqueue(op);
            }
        }