# HG changeset patch # User Adam Chlipala # Date 1381752537 14400 # Node ID 77cde56d41b6c94257c5a7bfe6f900d7219a7b3f # Parent a5b08bdfa450ec9e045a81499f1ff658be7be257 Change Pthread thread creation logic to avoid Cygwin limitations with setting stack size diff -r a5b08bdfa450 -r 77cde56d41b6 src/c/request.c --- a/src/c/request.c Fri Oct 11 17:15:28 2013 -0400 +++ b/src/c/request.c Mon Oct 14 08:08:57 2013 -0400 @@ -127,18 +127,20 @@ 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); + } else { + return pthread_create(outThread, NULL, threadFunc, arg); } - - return pthread_create(outThread, &stackSizeAttribute, threadFunc, arg); } void uw_request_init(uw_app *app, void *logger_data, uw_logger log_error, uw_logger log_debug) {