From 05130f2d406e5f1c618ab6865000322e75157a7c Mon Sep 17 00:00:00 2001 From: Jim Harris Date: Tue, 12 Feb 2019 15:49:23 -0700 Subject: [PATCH] stub: remove use of max_delay_us Ben's having to work around all of the max_delay_us code in his thread/reactor refactoring. Once we have a real scheduler, this whole idea will need to be rethought. So for now, let's get existing code off of the max_delay_us mechanism, so that we can remove it. For the stub app, just add a poller that does a usleep. This will have the same effect as the current behavior. Signed-off-by: Jim Harris Change-Id: Iabfba6e0c5a15a688f65ba33a788bd346359d072 Reviewed-on: https://review.gerrithub.io/c/444303 Tested-by: SPDK CI Jenkins Reviewed-by: Shuhei Matsumoto Reviewed-by: Darek Stojaczyk Reviewed-by: Ben Walker --- test/app/stub/stub.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/test/app/stub/stub.c b/test/app/stub/stub.c index 12ba850b0..fd4136b55 100644 --- a/test/app/stub/stub.c +++ b/test/app/stub/stub.c @@ -36,8 +36,10 @@ #include "spdk/event.h" #include "spdk/nvme.h" #include "spdk/string.h" +#include "spdk/thread.h" static char g_path[256]; +static struct spdk_poller *g_poller; static void usage(char *executable_name) @@ -70,6 +72,13 @@ attach_cb(void *cb_ctx, const struct spdk_nvme_transport_id *trid, { } +static int +stub_sleep(void *arg) +{ + usleep(1000 * 1000); + return 0; +} + static void stub_start(void *arg1, void *arg2) { @@ -87,11 +96,14 @@ stub_start(void *arg1, void *arg2) fprintf(stderr, "could not create sentinel file %s\n", g_path); exit(1); } + + g_poller = spdk_poller_register(stub_sleep, NULL, 0); } static void stub_shutdown(void) { + spdk_poller_unregister(&g_poller); unlink(g_path); spdk_app_stop(0); } @@ -149,7 +161,6 @@ main(int argc, char **argv) } opts.shutdown_cb = stub_shutdown; - opts.max_delay_us = 1000 * 1000; ch = spdk_app_start(&opts, stub_start, (void *)(intptr_t)opts.shm_id, NULL); spdk_app_fini();