shithub: orca

Download patch

ref: 5296e55cfb065247016be4632c9fb30425425908
parent: 1922f2108488c615d9a0c898bf19906cc94693ab
author: Sigrid Haflínudóttir <ftrvxmtrx@gmail.com>
date: Sun Feb 16 10:31:09 EST 2020

plan9: move events object to orcathread

--- a/plan9.c
+++ b/plan9.c
@@ -72,7 +72,6 @@
 static int charw, charh;
 static Field field;
 static Mbuf_reusable mbuf, mscr;
-static Oevent_list events;
 static char filename[256];
 static Channel *cchan;
 static Field copyfield, selfield;
@@ -264,10 +263,13 @@
 {
 	vlong start, end, n;
 	vlong processold, processnew;
+	Oevent_list events;
 	int w, h;
 
 	threadsetname("orca/sim");
 
+	oevent_list_init(&events);
+
 	processnew = nanosec();
 	for (;;) {
 		start = nanosec();
@@ -774,8 +776,6 @@
 	mbuf_reusable_ensure_size(&mscr, h, w);
 	memset(mscr.buffer, 0, w*h);
 
-	oevent_list_init(&events);
-
 	proccreate(orcathread, a[Credraw].c, mainstacksize);
 	shiftdown = 0;
 	altdown = 0;
@@ -1053,9 +1053,6 @@
 
 end:
 	mbuf_reusable_deinit(&mscr);
-	mbuf_reusable_deinit(&mbuf);
-	oevent_list_deinit(&events);
-	field_deinit(&field);
 	field_deinit(&copyfield);
 	field_deinit(&selfield);
 	free(linebuf);