git: 9front

Download patch

ref: d5d8452cc9e750e6170c1ca842c5f792d766b8dc
parent: 6570f6eb2126976ce1472aa8d1930f899ebf4fd4
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Sun Aug 9 23:52:40 EDT 2015

lib9p: make reqqueueflush() use new threadint(), which will also cover channel operations

using "interrupt" ctl message directly doesnt work when the
process is doing libthread channel operations (threadrendezvous)
as it will just repeat a interrupted rendezvous(). threadint()
handles this for us.

--- a/sys/src/lib9p/queue.c
+++ b/sys/src/lib9p/queue.c
@@ -12,10 +12,10 @@
 	void (*f)(Req *);
 	int fd;
 	char *buf;
-	
+
 	q = v;
 	rfork(RFNOTEG);
-	
+
 	buf = smprint("/proc/%d/ctl", getpid());
 	fd = open(buf, OWRITE);
 	free(buf);
@@ -48,7 +48,7 @@
 	memset(q, 0, sizeof(*q));
 	q->l = q;
 	q->next = q->prev = q;
-	q->pid = threadpid(proccreate(_reqqueueproc, q, mainstacksize));
+	q->pid = proccreate(_reqqueueproc, q, mainstacksize);
 	return q;
 }
 
@@ -68,17 +68,9 @@
 void
 reqqueueflush(Reqqueue *q, Req *r)
 {
-	char buf[128];
-	int fd;
-
 	qlock(q);
 	if(q->cur == r){
-		sprint(buf, "/proc/%d/ctl", q->pid);
-		fd = open(buf, OWRITE);
-		if(fd >= 0){
-			write(fd, "interrupt", 9);
-			close(fd);
-		}
+		threadint(q->pid);
 		q->flush++;
 		qunlock(q);
 	}else{
--