summaryrefslogtreecommitdiffhomepage
path: root/src/nxt_thread_id.h
blob: f8a525338e0f606be80727fad4a6fde580a13c62 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65

/*
 * Copyright (C) Igor Sysoev
 * Copyright (C) NGINX, Inc.
 */

#ifndef _NXT_UNIX_THREAD_ID_H_INCLUDED_
#define _NXT_UNIX_THREAD_ID_H_INCLUDED_


#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)


#endif /* _NXT_UNIX_THREAD_ID_H_INCLUDED_ */