Commit 603a6de8 authored by Ben Walker's avatar Ben Walker
Browse files

thread: Add spdk_thread_lib_init and fini



These don't do anything yet.

Change-Id: I718c6fb19c059a39bc5cb360c3da47ec05bfa416
Signed-off-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/423767


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
parent 828008f1
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -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.
 *
+4 −0
Original line number Diff line number Diff line
@@ -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
+11 −0
Original line number Diff line number Diff line
@@ -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,