From 1d2533d0101fd1721ab26837485c0b094205c3bd Mon Sep 17 00:00:00 2001 From: rsc Date: Tue, 28 Dec 2004 22:36:24 +0000 Subject: restore old plan 9 property that when the last thread exits the main proc, the remaining program ends up in the background and the program appears to have exited. --- src/libthread/thread.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/libthread/thread.c') diff --git a/src/libthread/thread.c b/src/libthread/thread.c index 92e93940..84e21717 100644 --- a/src/libthread/thread.c +++ b/src/libthread/thread.c @@ -476,6 +476,8 @@ main(int argc, char **argv) { Proc *p; + argv0 = argv[0]; + _threadsetupdaemonize(); threadargc = argc; @@ -503,7 +505,8 @@ main(int argc, char **argv) mainstacksize = 65536; _threadcreate(p, threadmainstart, nil, mainstacksize); scheduler(p); - return 0; /* not reached */ + threaddaemonize(); + _threadpexit(); } /* -- cgit v1.2.3