Exemple #1
0
        public static void Enqueue(this LinkedList <AsyncLock.SyncTask> queue, AsyncLock.SyncTask item)
        {
            if (item.Node != null)
            {
                throw new ArgumentException("Already assigned to some queue.", "item");
            }
            Contract.EndContractBlock();

            item.Node = queue.AddLast(item);
        }
Exemple #2
0
        public static bool RemoveO1(this LinkedList <AsyncLock.SyncTask> queue, AsyncLock.SyncTask item)
        {
            if (item.Node == null || !Object.ReferenceEquals(item.Node.List, queue) || item.Node.Value != item)
            {
                return(false);
            }

            queue.Remove(item.Node);
            item.Node = null;
            return(true);
        }