refactor: simplify the Plan 9 runtime loop
This commit is contained in:
20
main.c
20
main.c
@@ -7,13 +7,6 @@ Channel *dictreqc;
|
||||
Channel *dictresc;
|
||||
char *fontdir;
|
||||
|
||||
int
|
||||
threadmaybackground(void)
|
||||
{
|
||||
/* Keep the launcher PID stable so supervisors can own this daemon. */
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
usage(void)
|
||||
{
|
||||
@@ -39,10 +32,9 @@ emalloc(ulong n)
|
||||
{
|
||||
void *p;
|
||||
|
||||
p = malloc(n);
|
||||
p = mallocz(n, 1);
|
||||
if(p == nil)
|
||||
die("out of memory");
|
||||
memset(p, 0, n);
|
||||
return p;
|
||||
}
|
||||
|
||||
@@ -58,9 +50,6 @@ erealloc(void *p, ulong n)
|
||||
void
|
||||
threadmain(int argc, char **argv)
|
||||
{
|
||||
Channel *waitc;
|
||||
uchar stop;
|
||||
|
||||
if(argc != 3)
|
||||
usage();
|
||||
|
||||
@@ -81,10 +70,5 @@ threadmain(int argc, char **argv)
|
||||
die("can't create Wayland worker");
|
||||
if(threadcreate(dictthread, nil, 16384) < 0)
|
||||
die("can't create dictionary worker");
|
||||
if(threadcreate(imthread, nil, 16384) < 0)
|
||||
die("can't create input worker");
|
||||
|
||||
/* Keep the supervising process and its externally visible PID alive. */
|
||||
waitc = chancreate(sizeof stop, 0);
|
||||
chanrecv(waitc, &stop);
|
||||
imthread(nil);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user