summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorValentin Bartenev <vbart@nginx.com>2018-07-27 17:52:21 +0300
committerValentin Bartenev <vbart@nginx.com>2018-07-27 17:52:21 +0300
commit4b67de4bbb7f7cc6e1337ab9b7479695fd068b74 (patch)
treeddbdcdd46074925b7ab428ff58fe26cc5a6ab257
parent12c890c1ca09bdd77fd653d247b13f1c22ea3f0a (diff)
downloadunit-4b67de4bbb7f7cc6e1337ab9b7479695fd068b74.tar.gz
unit-4b67de4bbb7f7cc6e1337ab9b7479695fd068b74.tar.bz2
Removed implicit call of nxt_thread() in nxt_thread_tid().
Explicit is better than implicit © The Zen of Python. The nxt_thread_tid(NULL) call was used only twice in the code and such behaviour was specific to nxt_thread_tid() function.
-rw-r--r--src/nxt_mp.c2
-rw-r--r--src/nxt_random.c2
-rw-r--r--src/nxt_thread.c4
3 files changed, 2 insertions, 6 deletions
diff --git a/src/nxt_mp.c b/src/nxt_mp.c
index a1ccd058..a0f19ac2 100644
--- a/src/nxt_mp.c
+++ b/src/nxt_mp.c
@@ -233,7 +233,7 @@ nxt_mp_thread_adopt(nxt_mp_t *mp)
{
#if (NXT_DEBUG)
mp->pid = nxt_pid;
- mp->tid = nxt_thread_tid(NULL);
+ mp->tid = nxt_thread_tid(nxt_thread());
#endif
}
diff --git a/src/nxt_random.c b/src/nxt_random.c
index aaa39887..1211896c 100644
--- a/src/nxt_random.c
+++ b/src/nxt_random.c
@@ -99,7 +99,7 @@ nxt_random_stir(nxt_random_t *r)
key.value[0] ^= tv.tv_usec;
key.value[1] ^= tv.tv_sec;
key.value[2] ^= nxt_pid;
- key.value[3] ^= (uintptr_t) nxt_thread_tid(NULL);
+ key.value[3] ^= (uintptr_t) nxt_thread_tid(nxt_thread());
}
nxt_random_add(r, key.bytes, NXT_RANDOM_KEY_SIZE);
diff --git a/src/nxt_thread.c b/src/nxt_thread.c
index 72429f4d..f3804719 100644
--- a/src/nxt_thread.c
+++ b/src/nxt_thread.c
@@ -242,10 +242,6 @@ nxt_thread_wait(nxt_thread_handle_t handle)
nxt_tid_t
nxt_thread_tid(nxt_thread_t *thr)
{
- if (thr == NULL) {
- thr = nxt_thread();
- }
-
#if (NXT_HAVE_THREAD_STORAGE_CLASS)
if (nxt_slow_path(thr->tid == 0)) {