diff options
author | aiju <aiju@phicode.de> | 2011-08-20 12:30:06 +0200 |
---|---|---|
committer | aiju <aiju@phicode.de> | 2011-08-20 12:30:06 +0200 |
commit | 8434f98cdda98c5463ccc3ba89feeeda064e873c (patch) | |
tree | 2cc45651702f284b77c1c5a99ef248c1e409cf67 /sys/src/lib9p | |
parent | 0a0435dbc128705e1e4e3c1e2d45f686485d1dcd (diff) |
added interrupt proc ctl message
Diffstat (limited to 'sys/src/lib9p')
-rw-r--r-- | sys/src/lib9p/queue.c | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/sys/src/lib9p/queue.c b/sys/src/lib9p/queue.c index d77d4552e..c0b52f94e 100644 --- a/sys/src/lib9p/queue.c +++ b/sys/src/lib9p/queue.c @@ -4,24 +4,27 @@ #include <fcall.h> #include <9p.h> -static int -_reqqueuenote(void *, char *note) -{ - return strcmp(note, "flush") == 0; -} - static void _reqqueueproc(void *v) { Reqqueue *q; Req *r; void (*f)(Req *); + int fd; + char *buf; q = v; rfork(RFNOTEG); - threadnotify(_reqqueuenote, 1); + + buf = smprint("/proc/%d/ctl", getpid()); + fd = open(buf, OWRITE); + free(buf); + for(;;){ qlock(q); + q->flush = 0; + if(fd >= 0) + write(fd, "nointerrupt", 11); q->cur = nil; while(q->next == q) rsleep(q); @@ -65,9 +68,18 @@ reqqueuepush(Reqqueue *q, Req *r, void (*f)(Req *)) void reqqueueflush(Reqqueue *q, Req *r) { + char buf[128]; + int fd; + qlock(q); if(q->cur == r){ - postnote(PNPROC, q->pid, "flush"); + sprint(buf, "/proc/%d/ctl", q->pid); + fd = open(buf, OWRITE); + if(fd >= 0){ + write(fd, "interrupt", 9); + close(fd); + } + q->flush++; qunlock(q); }else{ if(r->qu.next != nil){ |