예제 #1
0
        public void EnqueueData(object data_val)
        {
            this.debugIt(false, "EnqueueData", (string)data_val);

            /* queue is too big */
            if ((this.MaxQueueLength != 0) && (this.QueueLength > this.MaxQueueLength))
            {
                //phwangFree(data_val, "QueueClass::enqueueData");
                //this->abend("enqueueData", "queue full");
                return;
            }

            QueueEntryClass entry = new QueueEntryClass();

            if (entry == null)
            {
                //this->abend("enqueueData", "fail to create new QueueEntryClass");
                return;
            }
            entry.data = data_val;

            this.AbendQueue("enqueueData begin");
            lock (this.theLock)
            {
                this.EnqueueEntry(entry);
                if (this.theSignal != null)
                {
                    this.theSignal.Set();
                }
            }

            this.AbendQueue("enqueueData end");

            this.debugIt(false, "EnqueueData", "done");
        }
예제 #2
0
 private void EnqueueEntry(QueueEntryClass entry)
 {
     if (this.QueueHead == null)
     {
         entry.next       = null;
         entry.prev       = null;
         this.QueueHead   = entry;
         this.QueueTail   = entry;
         this.QueueLength = 1;
     }
     else
     {
         entry.next          = null;
         entry.prev          = this.QueueTail;
         this.QueueTail.next = entry;
         this.QueueTail      = entry;
         this.QueueLength++;
     }
 }