nxt_thread.c (564:762f8c976ead) nxt_thread.c (735:3f7538f0681a)
1
2/*
3 * Copyright (C) Igor Sysoev
4 * Copyright (C) NGINX, Inc.
5 */
6
7#include <nxt_main.h>
8

--- 223 unchanged lines hidden (view full) ---

232 nxt_thread_log_debug("thread wait: %PH", handle);
233
234 err = pthread_join(handle, NULL);
235
236 if (err != 0) {
237 nxt_main_log_alert("pthread_join(%PH) failed %E", handle, err);
238 }
239}
1
2/*
3 * Copyright (C) Igor Sysoev
4 * Copyright (C) NGINX, Inc.
5 */
6
7#include <nxt_main.h>
8

--- 223 unchanged lines hidden (view full) ---

232 nxt_thread_log_debug("thread wait: %PH", handle);
233
234 err = pthread_join(handle, NULL);
235
236 if (err != 0) {
237 nxt_main_log_alert("pthread_join(%PH) failed %E", handle, err);
238 }
239}
240
241
242nxt_tid_t
243nxt_thread_tid(nxt_thread_t *thr)
244{
245 if (thr == NULL) {
246 thr = nxt_thread();
247 }
248
249#if (NXT_HAVE_THREAD_STORAGE_CLASS)
250
251 if (nxt_slow_path(thr->tid == 0)) {
252 thr->tid = nxt_thread_get_tid();
253 }
254
255 return thr->tid;
256
257#else
258
259 if (nxt_fast_path(thr != NULL)) {
260
261 if (nxt_slow_path(thr->tid == 0)) {
262 thr->tid = nxt_thread_get_tid();
263 }
264
265 return thr->tid;
266 }
267
268 return nxt_thread_get_tid();
269
270#endif
271}