Since it's proven a little tricky. Signed-off-by: Andy Grover <agro...@redhat.com> --- usr/actor.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-)
diff --git a/usr/actor.c b/usr/actor.c index 2e1f038..8347cf6 100644 --- a/usr/actor.c +++ b/usr/actor.c @@ -92,16 +92,23 @@ actor_insert_on_pend_list(actor_t *thread, uint32_t delay_secs) /* insert new entry in sort order */ list_for_each_entry(next_thread, &pend_list, list) { - log_debug(7, "thread %p %lld", next_thread, + if (time_after(next_thread->ttschedule, thread->ttschedule)) { + log_debug(7, "next thread %p due %lld", next_thread, (long long)next_thread->ttschedule); + log_debug(7, "new thread %p is before (%lld), inserting", thread, + (long long)thread->ttschedule); - if (time_after(next_thread->ttschedule, thread->ttschedule)) { /* insert new thread before the next thread */ __list_add(&thread->list, next_thread->list.prev, &next_thread->list); goto inserted; } } + log_debug(7, "last thread %p due %lld", next_thread, + (long long)next_thread->ttschedule); + log_debug(7, "new thread %p is after (%lld), inserting at tail", thread, + (long long)thread->ttschedule); + /* Not before any existing entries */ list_add_tail(&thread->list, &pend_list); @@ -213,11 +220,13 @@ actor_poll(void) * Actors are in sorted order of ascending run time, so * stop at the first unripe entry. */ + log_debug(7, "current time %" PRIu64, current_time); + list_for_each_entry_safe(thread, tmp, &pend_list, list) { uint64_t time_left = actor_time_left(thread, current_time); if (time_left) { - log_debug(7, "thread %08lx wait some more", - (long)thread); + log_debug(7, "thread %08lx due %" PRIu64 ", wait %" PRIu64 " more", + (long)thread, thread->ttschedule, time_left); alarm(time_left); break; @@ -257,7 +266,7 @@ actor_poll(void) thread->state = ACTOR_NOTSCHEDULED; log_debug(7, "exec thread %08lx callback", (long)thread); thread->callback(thread->data); - log_debug(7, "thread removed\n"); + log_debug(7, "thread %08lx removed", (long)thread); } poll_in_progress = 0; } -- 2.1.0 -- You received this message because you are subscribed to the Google Groups "open-iscsi" group. To unsubscribe from this group and stop receiving emails from it, send an email to open-iscsi+unsubscr...@googlegroups.com. To post to this group, send email to open-iscsi@googlegroups.com. Visit this group at http://groups.google.com/group/open-iscsi. For more options, visit https://groups.google.com/d/optout.