diff options
author | Xavi Hernandez <xhernandez@redhat.com> | 2019-01-24 18:31:10 +0100 |
---|---|---|
committer | Xavi Hernandez <xhernandez@redhat.com> | 2019-02-01 10:37:20 +0100 |
commit | 4674678951a1315975d66016fb55c49100b7819f (patch) | |
tree | 6572b7186f06c6405badc67cd1f3dbf450c4df6d /xlators/cluster | |
parent | 6b98735956c599ea621fa560b201fb7de6c36cac (diff) |
core: make gf_thread_create() easier to use
This patch creates a specific function to set the thread name using a
string format and a variable argument list, like printf().
This function is used to set the thread name from gf_thread_create(),
which now accepts a variable argument list to create the full name. It's
not necessary anymore to use a local array to build the name of the
thread. This is done automatically.
Change-Id: Idd8d01fd462c227359b96e98699f8c6d962dc17c
Updates: bz#1193929
Signed-off-by: Xavi Hernandez <xhernandez@redhat.com>
Diffstat (limited to 'xlators/cluster')
-rw-r--r-- | xlators/cluster/dht/src/dht-rebalance.c | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/xlators/cluster/dht/src/dht-rebalance.c b/xlators/cluster/dht/src/dht-rebalance.c index 46acc77c4b0..e0f25b1d080 100644 --- a/xlators/cluster/dht/src/dht-rebalance.c +++ b/xlators/cluster/dht/src/dht-rebalance.c @@ -4436,9 +4436,6 @@ gf_defrag_parallel_migration_init(xlator_t *this, gf_defrag_info_t *defrag, int thread_spawn_count = 0; int index = 0; pthread_t *tid = NULL; - char thread_name[GF_THREAD_NAMEMAX] = { - 0, - }; if (!defrag) goto out; @@ -4472,10 +4469,8 @@ gf_defrag_parallel_migration_init(xlator_t *this, gf_defrag_info_t *defrag, /*Spawn Threads Here*/ while (index < thread_spawn_count) { - snprintf(thread_name, sizeof(thread_name), "dhtmig%d", - ((index + 1) & 0x3ff)); ret = gf_thread_create(&(tid[index]), NULL, &gf_defrag_task, - (void *)defrag, thread_name); + (void *)defrag, "dhtmig%d", (index + 1) & 0x3ff); if (ret != 0) { gf_msg("DHT", GF_LOG_ERROR, ret, 0, "Thread[%d] creation failed. ", index); |