different fix
diff --git a/src/libthread/BSD.c b/src/libthread/BSD.c
index 8090ea5..3dbb3b2 100644
--- a/src/libthread/BSD.c
+++ b/src/libthread/BSD.c
@@ -285,6 +285,9 @@
 	int i, npid, mypid;
 	Proc *p;
 
+	if(msg == nil)
+		msg = "";
+
 	/* 
 	 * Only one guy, ever, gets to run this.
 	 * If two guys do it, inevitably they end up
@@ -296,7 +299,9 @@
 	 */
 	{
 		static Lock onelock;
-		lock(&onelock);
+		if(!canlock(&onelock))
+			_exits(threadexitsmsg);
+		threadexitsmsg = msg;
 	}
 
 	if(msg == nil)
diff --git a/src/libthread/Linux.c b/src/libthread/Linux.c
index 1469885..dab12d3 100644
--- a/src/libthread/Linux.c
+++ b/src/libthread/Linux.c
@@ -311,6 +311,9 @@
 	int i, npid, mypid;
 	Proc *p;
 
+	if(msg == nil)
+		msg = "";
+
 	/* 
 	 * Only one guy, ever, gets to run this.
 	 * If two guys do it, inevitably they end up
@@ -322,14 +325,13 @@
 	 */
 	{
 		static Lock onelock;
-		lock(&onelock);
+		if(!canlock(&onelock))
+			_exits(threadexitsmsg);
+		threadexitsmsg = msg;
 	}
 
-	if(msg == nil)
-		msg = "";
 	mypid = getpid();
 	lock(&_threadprocslock);
-	threadexitsmsg = msg;
 	npid = 0;
 	for(p=_threadprocs; p; p=p->next)
 		if(p->osprocid != mypid && p->osprocid >= 1)