summaryrefslogtreecommitdiff
path: root/src/c
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adam@chlipala.net>2013-10-14 08:08:57 -0400
committerGravatar Adam Chlipala <adam@chlipala.net>2013-10-14 08:08:57 -0400
commita80d82b96361a5beef3a543088f4b3460e972493 (patch)
treeabad023d3a9f17b9220d252418ccbc517a4fc681 /src/c
parentbdef0ddd54f378d1df86f66676b3319724899e7e (diff)
Change Pthread thread creation logic to avoid Cygwin limitations with setting stack size
Diffstat (limited to 'src/c')
-rw-r--r--src/c/request.c16
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) {