예제 #1
0
 TaskControlBlock run(Packet packet)
 {
     if (packet != null)
     {
         if (packet.kind == Support.KIND_WORK)
         {
             this.v1 = packet.addTo(this.v1);
         }
         else
         {
             this.v2 = packet.addTo(this.v2);
         }
     }
     if (this.v1 != null)
     {
         int    count = this.v1.a1;
         Packet v;
         if (count < Support.DATA_SIZE)
         {
             if (this.v2 != null)
             {
                 v          = this.v2;
                 this.v2    = this.v2.link;
                 v.a1       = this.v1.a2[count];
                 this.v1.a1 = count + 1;
                 return(this.scheduler.queue(v));
             }
         }
         else
         {
             v       = this.v1;
             this.v1 = this.v1.link;
             return(this.scheduler.queue(v));
         }
     }
     return(this.scheduler.suspendCurrent());
 }
예제 #2
0
 /**
  * Adds a packet to the worklist of this block's task, marks this as runnable if
  * necessary, and returns the next runnable object to run (the one
  * with the highest priority).
  */
 public TaskControlBlock checkPriorityAdd(TaskControlBlock task, Packet packet)
 {
     if (this.queue == null)
     {
         this.queue = packet;
         this.markAsRunnable();
         if (this.priority >= task.priority)
         {
             return(this);
         }
     }
     else
     {
         this.queue = packet.addTo(this.queue);
     }
     return(task);
 }
예제 #3
0
      TaskControlBlock run(Packet packet)
 {
     if (packet != null)
     {
         if (packet.kind == Support.KIND_WORK)
         {
             this.v1 = packet.addTo(this.v1);
         }
         else
         {
             this.v2 = packet.addTo(this.v2);
         }
     }
     if (this.v1 != null)
     {
         int count = this.v1.a1;
         Packet v;
         if (count < Support.DATA_SIZE)
         {
             if (this.v2 != null)
             {
                 v = this.v2;
                 this.v2 = this.v2.link;
                 v.a1 = this.v1.a2[count];
                 this.v1.a1 = count + 1;
                 return this.scheduler.queue(v);
             }
         }
         else
         {
             v = this.v1;
             this.v1 = this.v1.link;
             return this.scheduler.queue(v);
         }
     }
     return this.scheduler.suspendCurrent();
 }
예제 #4
0
 /**
  * Adds a packet to the worklist of this block's task, marks this as runnable if
  * necessary, and returns the next runnable object to run (the one
  * with the highest priority).
  */
 public TaskControlBlock checkPriorityAdd(TaskControlBlock task, Packet packet)
 {
     if (this.queue == null)
     {
         this.queue = packet;
         this.markAsRunnable();
         if (this.priority >= task.priority) return this;
     }
     else
     {
         this.queue = packet.addTo(this.queue);
     }
     return task;
 }