From c6952d45dffb6ca38d72753028621bafd6f2cc04 Mon Sep 17 00:00:00 2001 From: Daniel Verkamp Date: Wed, 25 Jan 2017 16:38:42 -0700 Subject: [PATCH] event: replace outdated reactor run loop comment The work item queueing code was replaced with the current reactor/event model, but the block comment above _spdk_reactor_run() wasn't updated to match. Replace the pseudo-code with something resembling the current behavior, and delete the outdated paragraph below it. Change-Id: If0686c6a5d063f56d8ea3df9bf3a1e98eef40207 Signed-off-by: Daniel Verkamp --- lib/event/reactor.c | 28 ++++++++++------------------ 1 file changed, 10 insertions(+), 18 deletions(-) diff --git a/lib/event/reactor.c b/lib/event/reactor.c index 99a88be76..39166d1a8 100644 --- a/lib/event/reactor.c +++ b/lib/event/reactor.c @@ -281,27 +281,19 @@ _spdk_poller_unregister_complete(struct spdk_poller *poller) \code while (1) - if (new work items to be scheduled) - dequeue work item from new work item ring - enqueue work item to active work item ring - else if (active work item count > 0) - dequeue work item from active work item ring - invoke work item function pointer - if (work item state == RUNNING) - enqueue work item to active work item ring - else if (application state != RUNNING) - # exit the reactor loop - break - else - sleep for 100ms + if (events to run) + dequeue and run a batch of events + if (active pollers) + run the first poller in the list and move it to the back + + if (first timer poller has expired) + run the first timer poller and reinsert it in the timer list + + if (idle for at least SPDK_REACTOR_SPIN_TIME_US) + sleep until next timer poller is scheduled to expire \endcode -Note that new work items are posted to a separate ring so that the -active work item ring can be kept single producer/single consumer and -only be touched by reactor itself. This avoids atomic operations -on the active work item ring which would hurt performance. - */ static int _spdk_reactor_run(void *arg)