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.
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user