@@ 47,11 47,13 @@ themeproc(void *audio)
Biobuf *b;
char *s, *v[3];
int p[3], n, i;
+ static int pid;
threadsetname("themeproc");
pipe(p);
p[2] = *(int*)audio;
- procrfork(runpicker, p, 4096, RFFDG|RFNAMEG);
+ postnote(PNGROUP, pid, "interrupt");
+ pid = threadpid(procrfork(runpicker, p, 4096, RFFDG|RFNAMEG|RFNOTEG));
close(p[0]);
b = Bfdopen(p[1], OREAD);
@@ 81,6 83,7 @@ themeproc(void *audio)
break;
}
Bterm(b);
+ postnote(PNGROUP, pid, "interrupt");
threadexits(nil);
}
@@ 867,7 867,7 @@ threadmain(int argc, char **argv)
{ nil, &key, CHANRCV },
{ nil, nil, CHANEND },
};
- int fd, n, scrolling, oldpcur, oldbuttons, pnew, shuffled;
+ int fd, n, scrolling, oldpcur, oldbuttons, pnew, shuffled, themetid;
shuffled = 0;
ARGBEGIN{
@@ 927,6 927,7 @@ threadmain(int argc, char **argv)
redraw(1);
oldbuttons = 0;
scrolling = 0;
+ themetid = -1;
for(;;){
ev:
@@ 967,7 968,7 @@ ev:
if(m.buttons == 4){
n = menuhit(3, mctl, &menu3, nil);
if(n == 0)
- procrfork(themeproc, &audio, 4096, RFNOTEG);
+ themetid = proccreate(themeproc, &audio, 4096);
else if(n == 1)
goto end;
goto ev;
@@ 1112,5 1113,6 @@ ev:
}
end:
+ threadint(themetid);
threadexitsall(nil);
}