ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/libeio/xthread.h
(Generate patch)

Comparing libeio/xthread.h (file contents):
Revision 1.4 by root, Tue May 13 19:34:11 2008 UTC vs.
Revision 1.6 by root, Wed Apr 22 11:04:49 2009 UTC

111 111
112typedef pthread_t thread_t; 112typedef pthread_t thread_t;
113#define X_THREAD_PROC(name) static void *name (void *thr_arg) 113#define X_THREAD_PROC(name) static void *name (void *thr_arg)
114#define X_THREAD_ATFORK(prepare,parent,child) pthread_atfork (prepare, parent, child) 114#define X_THREAD_ATFORK(prepare,parent,child) pthread_atfork (prepare, parent, child)
115 115
116// the broken bsd's once more
117#ifndef PTHREAD_STACK_MIN
118# define PTHREAD_STACK_MIN 0
119#endif
120
121#ifndef XTHREAD_STACKSIZE
122# define XTHREAD_STACKSIZE sizeof (long) * 4096
123#endif
124
116static int 125static int
117thread_create (thread_t *tid, void *(*proc)(void *), void *arg) 126thread_create (thread_t *tid, void *(*proc)(void *), void *arg)
118{ 127{
119 int retval; 128 int retval;
120 sigset_t fullsigset, oldsigset; 129 sigset_t fullsigset, oldsigset;
121 pthread_attr_t attr; 130 pthread_attr_t attr;
122 131
123 pthread_attr_init (&attr); 132 pthread_attr_init (&attr);
124 pthread_attr_setdetachstate (&attr, PTHREAD_CREATE_DETACHED); 133 pthread_attr_setdetachstate (&attr, PTHREAD_CREATE_DETACHED);
125 pthread_attr_setstacksize (&attr, PTHREAD_STACK_MIN < sizeof (long) * 4096 134
126 ? sizeof (long) * 4096 : PTHREAD_STACK_MIN); 135 if (XTHREAD_STACKSIZE > 0)
136 pthread_attr_setstacksize (&attr, PTHREAD_STACK_MIN > (XTHREAD_STACKSIZE)
137 ? PTHREAD_STACK_MIN : (XTHREAD_STACKSIZE));
138
127#ifdef PTHREAD_SCOPE_PROCESS 139#ifdef PTHREAD_SCOPE_PROCESS
128 pthread_attr_setscope (&attr, PTHREAD_SCOPE_PROCESS); 140 pthread_attr_setscope (&attr, PTHREAD_SCOPE_PROCESS);
129#endif 141#endif
130 142
131 sigfillset (&fullsigset); 143 sigfillset (&fullsigset);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines