thread: Rename spdk_allocate_thread to spdk_thread_create
This mirrors pthread_create, which works more closely to the new style where SPDK libraries can spawn their own threads. Change-Id: Ic524c4c35bcf7c1611e4f261ebb64b98ac5a5a1b Signed-off-by: Ben Walker <benjamin.walker@intel.com> Reviewed-on: https://review.gerrithub.io/c/440596 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
This commit is contained in:
parent
1068e22da5
commit
b1c79d722b
@ -104,7 +104,7 @@ spdk_fio_init_thread(struct thread_data *td)
|
||||
fio_thread->td = td;
|
||||
td->io_ops_data = fio_thread;
|
||||
|
||||
fio_thread->thread = spdk_allocate_thread("fio_thread");
|
||||
fio_thread->thread = spdk_thread_create("fio_thread");
|
||||
if (!fio_thread->thread) {
|
||||
free(fio_thread);
|
||||
SPDK_ERRLOG("failed to allocate thread\n");
|
||||
|
@ -188,15 +188,15 @@ int spdk_thread_lib_init(spdk_new_thread_fn new_thread_fn);
|
||||
void spdk_thread_lib_fini(void);
|
||||
|
||||
/**
|
||||
* Initializes the calling thread for I/O channel allocation.
|
||||
* Creates a new SPDK thread object.
|
||||
*
|
||||
* \param name Human-readable name for the thread; can be retrieved with spdk_thread_get_name().
|
||||
* The string is copied, so the pointed-to data only needs to be valid during the
|
||||
* spdk_allocate_thread() call. May be NULL to specify no name.
|
||||
* spdk_thread_create() call. May be NULL to specify no name.
|
||||
*
|
||||
* \return a pointer to the allocated thread on success or NULL on failure..
|
||||
*/
|
||||
struct spdk_thread *spdk_allocate_thread(const char *name);
|
||||
struct spdk_thread *spdk_thread_create(const char *name);
|
||||
|
||||
/**
|
||||
* Release any resources related to the given thread and destroy it. Execution
|
||||
|
@ -291,7 +291,7 @@ _spdk_reactor_run(void *arg)
|
||||
char thread_name[32];
|
||||
|
||||
snprintf(thread_name, sizeof(thread_name), "reactor_%u", reactor->lcore);
|
||||
thread = spdk_allocate_thread(thread_name);
|
||||
thread = spdk_thread_create(thread_name);
|
||||
if (!thread) {
|
||||
return -1;
|
||||
}
|
||||
|
@ -584,7 +584,7 @@ void SpdkInitializeThread(void)
|
||||
struct spdk_thread *thread;
|
||||
|
||||
if (g_fs != NULL) {
|
||||
thread = spdk_allocate_thread("spdk_rocksdb");
|
||||
thread = spdk_thread_create("spdk_rocksdb");
|
||||
spdk_set_thread(thread);
|
||||
g_sync_args.channel = spdk_fs_alloc_io_channel_sync(g_fs);
|
||||
}
|
||||
|
@ -185,7 +185,7 @@ spdk_thread_lib_fini(void)
|
||||
}
|
||||
|
||||
struct spdk_thread *
|
||||
spdk_allocate_thread(const char *name)
|
||||
spdk_thread_create(const char *name)
|
||||
{
|
||||
struct spdk_thread *thread;
|
||||
|
||||
|
@ -87,7 +87,7 @@ allocate_threads(int num_threads)
|
||||
|
||||
for (i = 0; i < g_ut_num_threads; i++) {
|
||||
set_thread(i);
|
||||
thread = spdk_allocate_thread(NULL);
|
||||
thread = spdk_thread_create(NULL);
|
||||
assert(thread != NULL);
|
||||
g_ut_threads[i].thread = thread;
|
||||
}
|
||||
|
@ -374,7 +374,7 @@ spdk_thread(void *arg)
|
||||
struct spdk_thread *thread;
|
||||
struct ut_request *req;
|
||||
|
||||
thread = spdk_allocate_thread("thread1");
|
||||
thread = spdk_thread_create("thread1");
|
||||
spdk_set_thread(thread);
|
||||
|
||||
while (1) {
|
||||
@ -426,7 +426,7 @@ int main(int argc, char **argv)
|
||||
return CU_get_error();
|
||||
}
|
||||
|
||||
thread = spdk_allocate_thread("thread0");
|
||||
thread = spdk_thread_create("thread0");
|
||||
spdk_set_thread(thread);
|
||||
|
||||
pthread_create(&spdk_tid, NULL, spdk_thread, NULL);
|
||||
|
@ -204,7 +204,7 @@ test_nvmf_tcp_create(void)
|
||||
struct spdk_nvmf_tcp_transport *ttransport;
|
||||
struct spdk_nvmf_transport_opts opts;
|
||||
|
||||
thread = spdk_allocate_thread(NULL);
|
||||
thread = spdk_thread_create(NULL);
|
||||
SPDK_CU_ASSERT_FATAL(thread != NULL);
|
||||
spdk_set_thread(thread);
|
||||
|
||||
@ -276,7 +276,7 @@ test_nvmf_tcp_destroy(void)
|
||||
struct spdk_nvmf_transport *transport;
|
||||
struct spdk_nvmf_transport_opts opts;
|
||||
|
||||
thread = spdk_allocate_thread(NULL);
|
||||
thread = spdk_thread_create(NULL);
|
||||
SPDK_CU_ASSERT_FATAL(thread != NULL);
|
||||
spdk_set_thread(thread);
|
||||
|
||||
@ -304,7 +304,7 @@ test_nvmf_tcp_poll_group_create(void)
|
||||
struct spdk_nvmf_transport_poll_group *group;
|
||||
struct spdk_thread *thread;
|
||||
|
||||
thread = spdk_allocate_thread(NULL);
|
||||
thread = spdk_thread_create(NULL);
|
||||
SPDK_CU_ASSERT_FATAL(thread != NULL);
|
||||
spdk_set_thread(thread);
|
||||
|
||||
|
@ -345,7 +345,7 @@ thread_name(void)
|
||||
const char *name;
|
||||
|
||||
/* Create thread with no name, which automatically generates one */
|
||||
thread = spdk_allocate_thread(NULL);
|
||||
thread = spdk_thread_create(NULL);
|
||||
spdk_set_thread(thread);
|
||||
thread = spdk_get_thread();
|
||||
SPDK_CU_ASSERT_FATAL(thread != NULL);
|
||||
@ -354,7 +354,7 @@ thread_name(void)
|
||||
spdk_free_thread(thread);
|
||||
|
||||
/* Create thread named "test_thread" */
|
||||
thread = spdk_allocate_thread("test_thread");
|
||||
thread = spdk_thread_create("test_thread");
|
||||
spdk_set_thread(thread);
|
||||
thread = spdk_get_thread();
|
||||
SPDK_CU_ASSERT_FATAL(thread != NULL);
|
||||
|
Loading…
Reference in New Issue
Block a user