ref: c3c49fcd05049a0f89f84ed1a8ce3c7267ef8a8f
parent: 5806e1a6275b3d1211b2f05d15dddbd4f7f15b1c
author: Sigrid Haflínudóttir <[email protected]>
date: Mon Sep 21 11:38:14 EDT 2020
pthread_create: make sure attr isn't nil
--- a/src/plan9_thread.c
+++ b/src/plan9_thread.c
@@ -28,10 +28,13 @@
int
pthread_create(pthread_t *thread, const pthread_attr_t *attr, void *(*func)(void*), void *arg)
{
+ int stacksz = attr == nil ? 0 : attr->stack_size;
+ if(stacksz < 65536)
+ stacksz = 65536;
thread->waitchan = chancreate(sizeof(void*), 0);
thread->func = func;
thread->arg = arg;
- thread->pid = proccreate(thre, thread, attr->stack_size);
+ thread->pid = proccreate(thre, thread, stacksz);
return 0;
}