thread: Add spdk_thread_lib_init and fini

These don't do anything yet.

Change-Id: I718c6fb19c059a39bc5cb360c3da47ec05bfa416
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/423767
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Ben Walker 2018-08-28 16:27:18 -07:00
parent 828008f184
commit 603a6de8d5
3 changed files with 27 additions and 0 deletions

View File

@ -162,6 +162,18 @@ struct spdk_io_channel {
*/
};
/**
* Initialize the threading library. Must be called once prior to allocating any threads.
*
* \return 0 on success. Negated errno on failure.
*/
int spdk_thread_lib_init(void);
/**
* Release all resources associated with this library.
*/
void spdk_thread_lib_fini(void);
/**
* Initializes the calling thread for I/O channel allocation.
*

View File

@ -38,6 +38,7 @@
#include "spdk/env.h"
#include "spdk/log.h"
#include "spdk/conf.h"
#include "spdk/thread.h"
#include "spdk/trace.h"
#include "spdk/string.h"
#include "spdk/rpc.h"
@ -592,6 +593,8 @@ spdk_app_start(struct spdk_app_opts *opts, spdk_event_fn start_fn,
SPDK_NOTICELOG("Total cores available: %d\n", spdk_env_get_core_count());
spdk_thread_lib_init();
/*
* If mask not specified on command line or in configuration file,
* reactor_mask will be 0x1 which will enable core 0 to run one
@ -657,6 +660,7 @@ spdk_app_fini(void)
spdk_reactors_fini();
spdk_conf_free(g_spdk_app.config);
spdk_log_close();
spdk_thread_lib_fini();
}
static void

View File

@ -107,6 +107,17 @@ _set_thread_name(const char *thread_name)
#endif
}
int
spdk_thread_lib_init(void)
{
return 0;
}
void
spdk_thread_lib_fini(void)
{
}
struct spdk_thread *
spdk_allocate_thread(spdk_thread_pass_msg msg_fn,
spdk_start_poller start_poller_fn,