fix: keep the headless daemon running
This commit is contained in:
10
main.c
10
main.c
@@ -10,7 +10,8 @@ char *fontdir;
|
|||||||
int
|
int
|
||||||
threadmaybackground(void)
|
threadmaybackground(void)
|
||||||
{
|
{
|
||||||
return 1;
|
/* Keep the launcher PID stable so supervisors can own this daemon. */
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -57,6 +58,9 @@ erealloc(void *p, ulong n)
|
|||||||
void
|
void
|
||||||
threadmain(int argc, char **argv)
|
threadmain(int argc, char **argv)
|
||||||
{
|
{
|
||||||
|
Channel *waitc;
|
||||||
|
uchar stop;
|
||||||
|
|
||||||
if(argc != 3)
|
if(argc != 3)
|
||||||
usage();
|
usage();
|
||||||
|
|
||||||
@@ -80,5 +84,7 @@ threadmain(int argc, char **argv)
|
|||||||
if(threadcreate(imthread, nil, 16384) < 0)
|
if(threadcreate(imthread, nil, 16384) < 0)
|
||||||
die("can't create input worker");
|
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