comparison src/c/request.c @ 1882:77cde56d41b6

Change Pthread thread creation logic to avoid Cygwin limitations with setting stack size
author Adam Chlipala <adam@chlipala.net>
date Mon, 14 Oct 2013 08:08:57 -0400
parents f57983ba2a36
children d02c1a0d8082
comparison
equal deleted inserted replaced
1881:a5b08bdfa450 1882:77cde56d41b6
125 125
126 static unsigned long long stackSize; 126 static unsigned long long stackSize;
127 127
128 int pthread_create_big(pthread_t *outThread, void *foo, void *threadFunc, void *arg) 128 int pthread_create_big(pthread_t *outThread, void *foo, void *threadFunc, void *arg)
129 { 129 {
130 int err;
131 pthread_attr_t stackSizeAttribute;
132
133 err = pthread_attr_init(&stackSizeAttribute);
134 if (err) return err;
135
136 if (stackSize > 0) { 130 if (stackSize > 0) {
131 int err;
132 pthread_attr_t stackSizeAttribute;
133
134 err = pthread_attr_init(&stackSizeAttribute);
135 if (err) return err;
136
137 err = pthread_attr_setstacksize(&stackSizeAttribute, stackSize); 137 err = pthread_attr_setstacksize(&stackSizeAttribute, stackSize);
138 if (err) return err; 138 if (err) return err;
139 } 139
140 140 return pthread_create(outThread, &stackSizeAttribute, threadFunc, arg);
141 return pthread_create(outThread, &stackSizeAttribute, threadFunc, arg); 141 } else {
142 return pthread_create(outThread, NULL, threadFunc, arg);
143 }
142 } 144 }
143 145
144 void uw_request_init(uw_app *app, void *logger_data, uw_logger log_error, uw_logger log_debug) { 146 void uw_request_init(uw_app *app, void *logger_data, uw_logger log_error, uw_logger log_debug) {
145 uw_context ctx; 147 uw_context ctx;
146 failure_kind fk; 148 failure_kind fk;