// Token: 0x06003E7E RID: 15998 RVA: 0x00116BAC File Offset: 0x00114DAC private bool InternalDequeue(ref TQueueItem t) { bool flag = true; while (flag) { NetLockFreeQueue <TQueueItem> .pointer_t head = this.Head; NetLockFreeQueue <TQueueItem> .pointer_t tail = this.Tail; NetLockFreeQueue <TQueueItem> .pointer_t next = head.ptr.next; if (head.count == this.Head.count && head.ptr == this.Head.ptr) { if (head.ptr == tail.ptr) { if (next.ptr == null) { return(false); } NetLockFreeQueue <TQueueItem> .CAS(ref this.Tail, tail, new NetLockFreeQueue <TQueueItem> .pointer_t(next.ptr, tail.count + 1L)); } else { t = next.ptr.value; if (NetLockFreeQueue <TQueueItem> .CAS(ref this.Head, head, new NetLockFreeQueue <TQueueItem> .pointer_t(next.ptr, head.count + 1L))) { flag = false; Interlocked.Decrement(ref this._count); } } } } return(true); }
// Token: 0x06003E77 RID: 15991 RVA: 0x00116B5C File Offset: 0x00114D5C public NetLockFreeQueue(bool blocking) { NetLockFreeQueue <TQueueItem> .node_t ptr = new NetLockFreeQueue <TQueueItem> .node_t(); this.Head.ptr = (this.Tail.ptr = ptr); this._isBlocking = blocking; }
// Token: 0x06003E80 RID: 16000 RVA: 0x00116CA0 File Offset: 0x00114EA0 public void Clear() { NetLockFreeQueue <TQueueItem> .node_t ptr = new NetLockFreeQueue <TQueueItem> .node_t(); this.Head.ptr = (this.Tail.ptr = ptr); Interlocked.Exchange(ref this._count, 0L); }
// Token: 0x06003E7D RID: 15997 RVA: 0x00023288 File Offset: 0x00021488 private static bool CAS(ref NetLockFreeQueue <TQueueItem> .pointer_t destination, NetLockFreeQueue <TQueueItem> .pointer_t compared, NetLockFreeQueue <TQueueItem> .pointer_t exchange) { if (compared.ptr == Interlocked.CompareExchange <NetLockFreeQueue <TQueueItem> .node_t>(ref destination.ptr, exchange.ptr, compared.ptr)) { Interlocked.Exchange(ref destination.count, exchange.count); return(true); } return(false); }
// Token: 0x06003E82 RID: 16002 RVA: 0x00116D70 File Offset: 0x00114F70 public void Enqueue(TQueueItem queueItem) { if (this._isShutdown) { return; } NetLockFreeQueue <TQueueItem> .node_t node_t = new NetLockFreeQueue <TQueueItem> .node_t(); node_t.value = queueItem; bool flag = true; while (flag) { NetLockFreeQueue <TQueueItem> .pointer_t tail = this.Tail; NetLockFreeQueue <TQueueItem> .pointer_t next = tail.ptr.next; if (tail.count == this.Tail.count && tail.ptr == this.Tail.ptr) { if (next.ptr == null) { if (NetLockFreeQueue <TQueueItem> .CAS(ref tail.ptr.next, next, new NetLockFreeQueue <TQueueItem> .pointer_t(node_t, next.count + 1L))) { Interlocked.Increment(ref this._count); flag = false; if (this._isBlocking) { this._emptyEvent.Set(); } } } else { NetLockFreeQueue <TQueueItem> .CAS(ref this.Tail, tail, new NetLockFreeQueue <TQueueItem> .pointer_t(next.ptr, tail.count + 1L)); } } } }
// Token: 0x06003E87 RID: 16007 RVA: 0x00023323 File Offset: 0x00021523 public pointer_t(NetLockFreeQueue <TQueueItem> .node_t node, long c) { this.ptr = node; this.count = c; }
// Token: 0x06003E86 RID: 16006 RVA: 0x00023307 File Offset: 0x00021507 public pointer_t(NetLockFreeQueue <TQueueItem> .pointer_t p) { this.ptr = p.ptr; this.count = p.count; }
// Token: 0x06003E76 RID: 15990 RVA: 0x00116B14 File Offset: 0x00114D14 public NetLockFreeQueue() { NetLockFreeQueue <TQueueItem> .node_t ptr = new NetLockFreeQueue <TQueueItem> .node_t(); this.Head.ptr = (this.Tail.ptr = ptr); }