tlibthread: make page work on OS X - plan9port - [fork] Plan 9 from user space
(HTM) git clone git://src.adamsgaard.dk/plan9port
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
(DIR) commit 0829f75bba8a5eb60a7f46e21aa266736b4c4bab
(DIR) parent 5186b55afc97730b733a85cdcb38d6ee7fdd32c7
(HTM) Author: Russ Cox <rsc@swtch.com>
Date: Mon, 17 Aug 2009 17:29:44 -0700
libthread: make page work on OS X
Diffstat:
M src/libthread/exec.c | 1 +
M src/libthread/thread.c | 4 ++++
2 files changed, 5 insertions(+), 0 deletions(-)
---
(DIR) diff --git a/src/libthread/exec.c b/src/libthread/exec.c
t@@ -62,6 +62,7 @@ _threadspawn(int fd[3], char *cmd, char *argv[])
int i, n, p[2], pid;
char exitstr[100];
+ notifyoff("sys: child"); /* do not let child note kill us */
if(pipe(p) < 0)
return -1;
if(fcntl(p[0], F_SETFD, 1) < 0 || fcntl(p[1], F_SETFD, 1) < 0){
(DIR) diff --git a/src/libthread/thread.c b/src/libthread/thread.c
t@@ -155,6 +155,10 @@ _threadcreate(Proc *p, void (*fn)(void*), void *arg, uint stack)
{
_Thread *t;
+ /* defend against bad C libraries */
+ if(stack < (256<<10))
+ stack = 256<<10;
+
t = threadalloc(fn, arg, stack);
t->proc = p;
addthreadinproc(p, t);