games/galaxy: fix exit race condition by pausing the galaxy before threadexitsall
This commit is contained in:
parent
85b8d253d4
commit
b2b80a3da5
2 changed files with 15 additions and 6 deletions
|
@ -442,7 +442,7 @@ domenu(void)
|
||||||
G *= z;
|
G *= z;
|
||||||
break;
|
break;
|
||||||
case EXIT:
|
case EXIT:
|
||||||
threadexitsall(nil);
|
quit(nil);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
drawglxy();
|
drawglxy();
|
||||||
|
@ -496,14 +496,14 @@ kbdthread(void*)
|
||||||
|
|
||||||
for(;;) {
|
for(;;) {
|
||||||
recv(realkc->c, &r);
|
recv(realkc->c, &r);
|
||||||
if(r == Kdel) {
|
if(r == Kdel)
|
||||||
threadexitsall(nil);
|
quit(nil);
|
||||||
}
|
|
||||||
if(kc.c != nil)
|
if(kc.c != nil)
|
||||||
send(kc.c, &r);
|
send(kc.c, &r);
|
||||||
else switch(r) {
|
else switch(r) {
|
||||||
case 'q':
|
case 'q':
|
||||||
threadexitsall(nil);
|
quit(nil);
|
||||||
break;
|
break;
|
||||||
case 's':
|
case 's':
|
||||||
stats ^= 1;
|
stats ^= 1;
|
||||||
|
@ -538,10 +538,17 @@ tovector(Point p)
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
quit(char *e)
|
||||||
|
{
|
||||||
|
pause(0, 0);
|
||||||
|
threadexitsall(e);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
usage(void)
|
usage(void)
|
||||||
{
|
{
|
||||||
fprint(2, "Usage: %s [-t throttle] [-G gravity] [-ε smooth] [-i] [file]\n", argv0);
|
fprint(2, "Usage: %s [-t throttle] [-G gravity] [-ε smooth] [-p extraproc] [-i] [file]\n", argv0);
|
||||||
threadexitsall("usage");
|
threadexitsall("usage");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -49,6 +49,8 @@ enum {
|
||||||
BODY,
|
BODY,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void quit(char*);
|
||||||
|
|
||||||
Image *randcol(void);
|
Image *randcol(void);
|
||||||
Point topoint(Vector);
|
Point topoint(Vector);
|
||||||
Vector tovector(Point);
|
Vector tovector(Point);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue