… | |
… | |
75 | #endif |
75 | #endif |
76 | |
76 | |
77 | /* just in case */ |
77 | /* just in case */ |
78 | #define _REENTRANT 1 |
78 | #define _REENTRANT 1 |
79 | |
79 | |
|
|
80 | #if __solaris |
|
|
81 | /* try to bribe solaris headers into providing a current pthread API |
|
|
82 | * despite perl being configured for an older version. |
|
|
83 | */ |
|
|
84 | # define __EXTENSIONS__ 1 |
|
|
85 | #endif |
|
|
86 | |
80 | #include <unistd.h> |
87 | #include <unistd.h> |
81 | #include <fcntl.h> |
88 | #include <fcntl.h> |
82 | #include <signal.h> |
89 | #include <signal.h> |
|
|
90 | #include <limits.h> |
83 | #include <pthread.h> |
91 | #include <pthread.h> |
84 | |
92 | |
85 | typedef pthread_mutex_t mutex_t; |
93 | typedef pthread_mutex_t mutex_t; |
86 | #if __linux && defined (PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP) |
94 | #if __linux && defined (PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP) |
87 | # define X_MUTEX_INIT PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP |
95 | # define X_MUTEX_INIT PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP |
… | |
… | |
108 | sigset_t fullsigset, oldsigset; |
116 | sigset_t fullsigset, oldsigset; |
109 | pthread_attr_t attr; |
117 | pthread_attr_t attr; |
110 | |
118 | |
111 | pthread_attr_init (&attr); |
119 | pthread_attr_init (&attr); |
112 | pthread_attr_setdetachstate (&attr, PTHREAD_CREATE_DETACHED); |
120 | pthread_attr_setdetachstate (&attr, PTHREAD_CREATE_DETACHED); |
|
|
121 | pthread_attr_setstacksize (&attr, PTHREAD_STACK_MIN < sizeof (long) * 4096 |
|
|
122 | ? sizeof (long) * 4096 : PTHREAD_STACK_MIN); |
113 | #ifdef PTHREAD_SCOPE_PROCESS |
123 | #ifdef PTHREAD_SCOPE_PROCESS |
114 | pthread_attr_setscope (&attr, PTHREAD_SCOPE_PROCESS); |
124 | pthread_attr_setscope (&attr, PTHREAD_SCOPE_PROCESS); |
115 | #endif |
125 | #endif |
116 | |
126 | |
117 | sigfillset (&fullsigset); |
127 | sigfillset (&fullsigset); |