finish conversion to libthread; avoids extra page proc sticking around (Tim Wiess)

This commit is contained in:
rsc 2007-04-03 12:50:49 +00:00
parent 41deef57ef
commit 5cd829d589

View file

@ -2,7 +2,6 @@
#include <libc.h> #include <libc.h>
#include <draw.h> #include <draw.h>
#include <thread.h> #include <thread.h>
#include <thread.h>
#include <bio.h> #include <bio.h>
#include <cursor.h> #include <cursor.h>
#include "page.h" #include "page.h"
@ -33,6 +32,14 @@ watcher(void *v, char *x)
return 0; return 0;
} }
void
watcherproc(void *v)
{
threadnotify(watcher, 1);
for(;;)
sleep(1000);
}
int int
bell(void *u, char *x) bell(void *u, char *x)
{ {
@ -131,21 +138,14 @@ threadmain(int argc, char **argv)
notegp = getpid(); notegp = getpid();
switch(notewatcher = fork()){ notewatcher = proccreate(watcherproc, NULL, 1024);
case -1: if(notewatcher == -1){
sysfatal("fork\n"); sysfatal("proccreate");
threadexitsall(0); threadexitsall(0);
default:
break;
case 0:
atnotify(watcher, 1);
for(;;)
sleep(1000);
/* not reached */
} }
rfork(RFNOTEG); rfork(RFNOTEG);
atnotify(bell, 1); threadnotify(bell, 1);
readstdin = 0; readstdin = 0;
if(imagemode == 0 && argc == 0){ if(imagemode == 0 && argc == 0){