diff options
author | Adam Chlipala <adam@chlipala.net> | 2013-10-14 08:08:57 -0400 |
---|---|---|
committer | Adam Chlipala <adam@chlipala.net> | 2013-10-14 08:08:57 -0400 |
commit | d05e9343cbe1545602527e999e203c35f40d152a (patch) | |
tree | abad023d3a9f17b9220d252418ccbc517a4fc681 | |
parent | f69037ea493a13e6687d7c068acb40bae87c4761 (diff) |
Change Pthread thread creation logic to avoid Cygwin limitations with setting stack size
-rw-r--r-- | src/c/request.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/c/request.c b/src/c/request.c index 21011bd0..5973d979 100644 --- a/src/c/request.c +++ b/src/c/request.c @@ -127,18 +127,20 @@ static unsigned long long stackSize; int pthread_create_big(pthread_t *outThread, void *foo, void *threadFunc, void *arg) { - int err; - pthread_attr_t stackSizeAttribute; + if (stackSize > 0) { + int err; + pthread_attr_t stackSizeAttribute; - err = pthread_attr_init(&stackSizeAttribute); - if (err) return err; + err = pthread_attr_init(&stackSizeAttribute); + if (err) return err; - if (stackSize > 0) { err = pthread_attr_setstacksize(&stackSizeAttribute, stackSize); if (err) return err; - } - return pthread_create(outThread, &stackSizeAttribute, threadFunc, arg); + return pthread_create(outThread, &stackSizeAttribute, threadFunc, arg); + } else { + return pthread_create(outThread, NULL, threadFunc, arg); + } } void uw_request_init(uw_app *app, void *logger_data, uw_logger log_error, uw_logger log_debug) { |