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.
This commit is contained in:
@@ -233,7 +233,7 @@ nxt_mp_thread_adopt(nxt_mp_t *mp)
|
|||||||
{
|
{
|
||||||
#if (NXT_DEBUG)
|
#if (NXT_DEBUG)
|
||||||
mp->pid = nxt_pid;
|
mp->pid = nxt_pid;
|
||||||
mp->tid = nxt_thread_tid(NULL);
|
mp->tid = nxt_thread_tid(nxt_thread());
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ nxt_random_stir(nxt_random_t *r)
|
|||||||
key.value[0] ^= tv.tv_usec;
|
key.value[0] ^= tv.tv_usec;
|
||||||
key.value[1] ^= tv.tv_sec;
|
key.value[1] ^= tv.tv_sec;
|
||||||
key.value[2] ^= nxt_pid;
|
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);
|
nxt_random_add(r, key.bytes, NXT_RANDOM_KEY_SIZE);
|
||||||
|
|||||||
@@ -242,10 +242,6 @@ nxt_thread_wait(nxt_thread_handle_t handle)
|
|||||||
nxt_tid_t
|
nxt_tid_t
|
||||||
nxt_thread_tid(nxt_thread_t *thr)
|
nxt_thread_tid(nxt_thread_t *thr)
|
||||||
{
|
{
|
||||||
if (thr == NULL) {
|
|
||||||
thr = nxt_thread();
|
|
||||||
}
|
|
||||||
|
|
||||||
#if (NXT_HAVE_THREAD_STORAGE_CLASS)
|
#if (NXT_HAVE_THREAD_STORAGE_CLASS)
|
||||||
|
|
||||||
if (nxt_slow_path(thr->tid == 0)) {
|
if (nxt_slow_path(thr->tid == 0)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user