diff options
| author | Russ Cox <rsc@swtch.com> | 2020-12-30 00:10:11 -0500 |
|---|---|---|
| committer | Russ Cox <rsc@swtch.com> | 2020-12-30 00:12:14 -0500 |
| commit | b3a20a96eb2b91a5b0b8a8fb506e20a2fb50ebe8 (patch) | |
| tree | 0cebec89bb62594af9c5310e1ba99a4dee65b51b /src/libthread/thread.c | |
| parent | 5b37d9126474864b5299426e27b2af37fcc96dd0 (diff) | |
libthread: add threadmaybackground
Programs that want to background themselves now need
to define threadmaybackground returning 1.
This avoids a confusing (to people and debuggers)
extra parent process for all the threaded programs
that will never want to background themselves.
Diffstat (limited to 'src/libthread/thread.c')
| -rw-r--r-- | src/libthread/thread.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/libthread/thread.c b/src/libthread/thread.c index 65e65194..7151e875 100644 --- a/src/libthread/thread.c +++ b/src/libthread/thread.c @@ -844,7 +844,7 @@ main(int argc, char **argv) // Easier to just run in pthread-per-thread mode. pthreadperthread = 1; #endif - if(strstr(opts, "nodaemon") == nil && getenv("NOLIBTHREADDAEMONIZE") == nil) + if(threadmaybackground() && strstr(opts, "nodaemon") == nil && getenv("NOLIBTHREADDAEMONIZE") == nil) _threadsetupdaemonize(); threadargc = argc; |