app: add spdk_app_start_shutdown()
This enables using SPDK within a larger process that is SPDK-centric. In this case the process may start SPDK and then wish to stop it explicitly (without a signal). While here, remove an incorrect comment - DPDK mempools can be used from non-DPDK threads. Also set the g_shutdown_event to NULL after it is called. After the event executes, the event is freed and is no longer valid. Signed-off-by: Jim Harris <james.r.harris@intel.com> Change-Id: Ie4f07bee7d05fae683c72f6680cb3bcce2d4a119
This commit is contained in:
parent
ca998b329e
commit
3266d7dbcc
@ -167,6 +167,13 @@ int spdk_app_fini(void);
|
|||||||
*/
|
*/
|
||||||
int spdk_app_start(spdk_event_fn start_fn, void *arg1, void *arg2);
|
int spdk_app_start(spdk_event_fn start_fn, void *arg1, void *arg2);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Start shutting down the framework. Typically this function is not called directly, and
|
||||||
|
* the shutdown process is started implicitly by a process signal. But in applications that are
|
||||||
|
* using SPDK for a subset of its process threads, this function can be called in lieu of a signal.
|
||||||
|
*/
|
||||||
|
void spdk_app_start_shutdown(void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Stop the framework. This does not wait for all threads to exit. Instead, it kicks off
|
* \brief Stop the framework. This does not wait for all threads to exit. Instead, it kicks off
|
||||||
* the shutdown process and returns. Once the shutdown process is complete, \ref spdk_app_start will return.
|
* the shutdown process and returns. Once the shutdown process is complete, \ref spdk_app_start will return.
|
||||||
|
@ -189,18 +189,19 @@ spdk_get_log_facility(struct spdk_conf *config)
|
|||||||
return logfacility;
|
return logfacility;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
spdk_app_start_shutdown(void)
|
||||||
|
{
|
||||||
|
if (g_shutdown_event != NULL) {
|
||||||
|
spdk_event_call(g_shutdown_event);
|
||||||
|
g_shutdown_event = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
__shutdown_signal(int signo)
|
__shutdown_signal(int signo)
|
||||||
{
|
{
|
||||||
/*
|
spdk_app_start_shutdown();
|
||||||
* Call pre-allocated shutdown event. Note that it is not
|
|
||||||
* safe to allocate the event within the signal handlers
|
|
||||||
* context, since that context is not a DPDK thread so
|
|
||||||
* buffer allocation is not permitted.
|
|
||||||
*/
|
|
||||||
if (g_shutdown_event != NULL) {
|
|
||||||
spdk_event_call(g_shutdown_event);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
Loading…
Reference in New Issue
Block a user