twork around stupid linux bug - 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 8f4871fd2e9806293b0d6756402b8a019c732985
(DIR) parent 74fc94d47e68684567f16d3d09b822cdad721e4a
(HTM) Author: rsc <devnull@localhost>
Date: Sun, 13 Feb 2005 18:35:19 +0000
work around stupid linux bug
Diffstat:
M src/libthread/thread.c | 8 ++++++++
1 file changed, 8 insertions(+), 0 deletions(-)
---
(DIR) diff --git a/src/libthread/thread.c b/src/libthread/thread.c
t@@ -582,6 +582,14 @@ main(int argc, char **argv)
_threadcreate(p, threadmainstart, nil, mainstacksize);
procscheduler(p);
_threaddaemonize();
+ /*
+ * On Linux 2.6, if the main thread exits then the others
+ * keep running but the process shows up as a zombie in ps
+ * and is not attachable with ptrace. We'll just sit around
+ * instead of exiting.
+ */
+ for(;;)
+ sleep(1000);
_threadpexit();
return 0;
}