Initial version.

This commit is contained in:
Igor Sysoev
2017-01-17 20:00:00 +03:00
commit 16cbf3c076
235 changed files with 56359 additions and 0 deletions

81
src/nxt_thread_id.h Normal file
View File

@@ -0,0 +1,81 @@
/*
* Copyright (C) Igor Sysoev
* Copyright (C) NGINX, Inc.
*/
#ifndef _NXT_UNIX_THREAD_ID_H_INCLUDED_
#define _NXT_UNIX_THREAD_ID_H_INCLUDED_
#if (NXT_THREADS)
#if (NXT_LINUX)
typedef pid_t nxt_tid_t;
#elif (NXT_FREEBSD)
typedef uint32_t nxt_tid_t;
#elif (NXT_SOLARIS)
typedef pthread_t nxt_tid_t;
#elif (NXT_MACOSX)
typedef uint64_t nxt_tid_t;
#elif (NXT_AIX)
typedef tid_t nxt_tid_t;
#elif (NXT_HPUX)
typedef pthread_t nxt_tid_t;
#else
typedef pthread_t nxt_tid_t;
#endif
NXT_EXPORT nxt_tid_t nxt_thread_tid(nxt_thread_t *thr);
/*
* On Linux pthread_t is unsigned long integer.
* On FreeBSD, MacOSX, NetBSD, and OpenBSD pthread_t is pointer to a struct.
* On Solaris and AIX pthread_t is unsigned integer.
* On HP-UX pthread_t is int.
* On Cygwin pthread_t is pointer to void.
* On z/OS pthread_t is "struct { char __[0x08]; }".
*/
typedef pthread_t nxt_thread_handle_t;
#define \
nxt_thread_handle_clear(th) \
th = (pthread_t) 0
#define \
nxt_thread_handle_equal(th0, th1) \
pthread_equal(th0, th1)
#else /* !(NXT_THREADS) */
typedef uint32_t nxt_tid_t;
typedef uint32_t nxt_thread_handle_t;
#define \
nxt_thread_tid(thr) \
0
#endif
#endif /* _NXT_UNIX_THREAD_ID_H_INCLUDED_ */