aboutsummaryrefslogtreecommitdiff
path: root/src/libthread/thread.c
diff options
context:
space:
mode:
authorrsc <devnull@localhost>2005-01-13 04:49:19 +0000
committerrsc <devnull@localhost>2005-01-13 04:49:19 +0000
commitc8b6342d3c2a167dec16931815926e9e4387e7ef (patch)
tree80d3ec6ea074462b30639168113def880476dad6 /src/libthread/thread.c
parent741f510ce758f77ed5193256fb693a09a7daecce (diff)
downloadplan9port-c8b6342d3c2a167dec16931815926e9e4387e7ef.tar.gz
plan9port-c8b6342d3c2a167dec16931815926e9e4387e7ef.tar.bz2
plan9port-c8b6342d3c2a167dec16931815926e9e4387e7ef.zip
Many small edits.
Diffstat (limited to 'src/libthread/thread.c')
-rw-r--r--src/libthread/thread.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/src/libthread/thread.c b/src/libthread/thread.c
index 2b6d1e37..b886e30b 100644
--- a/src/libthread/thread.c
+++ b/src/libthread/thread.c
@@ -169,6 +169,7 @@ _threadswitch(void)
{
Proc *p;
+ needstack(0);
p = proc();
//print("threadswtch %p\n", p);
contextswitch(&p->thread->context, &p->schedcontext);
@@ -324,6 +325,20 @@ threadsetstate(char *fmt, ...)
va_end(arg);
}
+void
+needstack(int n)
+{
+ _Thread *t;
+
+ t = proc()->thread;
+
+ if((char*)&t <= (char*)t->stk
+ || (char*)&t - (char*)t->stk < 256+n){
+ fprint(2, "thread stack overflow\n");
+ abort();
+ }
+}
+
/*
* locking
*/
@@ -499,11 +514,6 @@ threadmainstart(void *v)
threadmain(threadargc, threadargv);
}
-void
-threadlinklibrary(void)
-{
-}
-
int
main(int argc, char **argv)
{