fix: keep the headless daemon running
This commit is contained in:
10
main.c
10
main.c
@@ -10,7 +10,8 @@ char *fontdir;
|
||||
int
|
||||
threadmaybackground(void)
|
||||
{
|
||||
return 1;
|
||||
/* Keep the launcher PID stable so supervisors can own this daemon. */
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
@@ -57,6 +58,9 @@ erealloc(void *p, ulong n)
|
||||
void
|
||||
threadmain(int argc, char **argv)
|
||||
{
|
||||
Channel *waitc;
|
||||
uchar stop;
|
||||
|
||||
if(argc != 3)
|
||||
usage();
|
||||
|
||||
@@ -80,5 +84,7 @@ threadmain(int argc, char **argv)
|
||||
if(threadcreate(imthread, nil, 16384) < 0)
|
||||
die("can't create input worker");
|
||||
|
||||
threadexits(nil);
|
||||
/* Keep the supervising process and its externally visible PID alive. */
|
||||
waitc = chancreate(sizeof stop, 0);
|
||||
chanrecv(waitc, &stop);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user