shithub: qk2

Download patch

ref: f88b27b503b2614a2d4f6c58b1b7c35e536bee5b
parent: 65d71cecde9091b4c926dd5711d3bf46fcba37fd
author: Konstantinn Bonnet <qu7uux@gmail.com>
date: Sun Mar 15 09:41:19 EDT 2015

fix Rendez lockups on crash

kill all threads started in IN_Init and SDDMA_Init when an "sys: " note is received.

--- a/plan9/in_9.c
+++ b/plan9/in_9.c
@@ -300,13 +300,6 @@
 	mouseon = false;
 }
 
-void sucks (void *, char *note)
-{
-	if(!strncmp(note, "sys:", 4))
-		IN_Shutdown();
-	noted(NDFLT);
-}
-
 void IN_Init (void)
 {
 	in_mouse = ri.Cvar_Get("in_mouse", "1", CVAR_ARCHIVE);
@@ -325,7 +318,6 @@
 	ri.Cmd_AddCommand("-mlook", IN_MLookUp);
 	ri.Cmd_AddCommand("force_centerview", IN_ForceCenterView);
 
-	notify(sucks);
 	kchan = chancreate(sizeof(Kev), Nbuf);
 	if((ktid = proccreate(kproc, nil, 8192)) < 0)
 		sysfatal("proccreate kproc: %r");
--- a/plan9/sys_9.c
+++ b/plan9/sys_9.c
@@ -102,11 +102,21 @@
 {
 }
 
+void croak (void *, char *note)
+{
+	if(!strncmp(note, "sys:", 4)){
+		IN_Shutdown();
+		SNDDMA_Shutdown();
+	}
+	noted(NDFLT);
+}
+
 void threadmain (int argc, char *argv[])
 {
 	int time, oldtime, newtime;
 
 	setfcr(getfcr() & ~(FPOVFL|FPUNFL|FPINVAL|FPZDIV));	/* assumed ignored in code */
+	notify(croak);
 
 	Qcommon_Init(argc, argv);