Put start events to proper queue.

This commit is contained in:
Yury Gribov 2016-07-10 20:37:35 +01:00 committed by Stephen Williams
parent c37d6ac3ac
commit 43cd693fe0
1 changed files with 17 additions and 53 deletions

View File

@ -725,78 +725,42 @@ static void schedule_event_(struct event_s*cur, vvp_time64_t delay,
receive the event at hand. Put the event in to the receive the event at hand. Put the event in to the
appropriate list for the kind of assign we have at hand. */ appropriate list for the kind of assign we have at hand. */
switch (select_queue) { struct event_s** q = 0;
switch (select_queue) {
case SEQ_START: case SEQ_START:
if (ctim->start == 0) { q = &ctim->start;
ctim->start = cur;
} else {
cur->next = ctim->active->next;
ctim->active->next = cur;
ctim->active = cur;
}
break; break;
case SEQ_ACTIVE: case SEQ_ACTIVE:
if (ctim->active == 0) { q = &ctim->active;
ctim->active = cur;
} else {
/* Put the cur event on the end of the active list. */
cur->next = ctim->active->next;
ctim->active->next = cur;
ctim->active = cur;
}
break; break;
case SEQ_NBASSIGN: case SEQ_NBASSIGN:
if (ctim->nbassign == 0) { q = &ctim->nbassign;
ctim->nbassign = cur;
} else {
/* Put the cur event on the end of the active list. */
cur->next = ctim->nbassign->next;
ctim->nbassign->next = cur;
ctim->nbassign = cur;
}
break; break;
case SEQ_RWSYNC: case SEQ_RWSYNC:
if (ctim->rwsync == 0) { q = &ctim->rwsync;
ctim->rwsync = cur;
} else {
/* Put the cur event on the end of the active list. */
cur->next = ctim->rwsync->next;
ctim->rwsync->next = cur;
ctim->rwsync = cur;
}
break; break;
case SEQ_ROSYNC: case SEQ_ROSYNC:
if (ctim->rosync == 0) { q = &ctim->rosync;
ctim->rosync = cur;
} else {
/* Put the cur event on the end of the active list. */
cur->next = ctim->rosync->next;
ctim->rosync->next = cur;
ctim->rosync = cur;
}
break; break;
case DEL_THREAD: case DEL_THREAD:
if (ctim->del_thr == 0) { q = &ctim->del_thr;
ctim->del_thr = cur;
} else {
/* Put the cur event on the end of the active list. */
cur->next = ctim->del_thr->next;
ctim->del_thr->next = cur;
ctim->del_thr = cur;
}
break; break;
} }
if (q) {
if (*q) {
/* Put the cur event on the end of the queue. */
cur->next = (*q)->next;
(*q)->next = cur;
}
*q = cur;
}
} }
static void schedule_event_push_(struct event_s*cur) static void schedule_event_push_(struct event_s*cur)