9front - general discussion about 9front
 help / color / mirror / Atom feed
* [9front] aux/wacom: possible race
@ 2021-12-06  2:50 qwx
  2021-12-06  3:08 ` Stanley Lieber
  2021-12-14 23:55 ` qwx
  0 siblings, 2 replies; 4+ messages in thread
From: qwx @ 2021-12-06  2:50 UTC (permalink / raw)
  To: 9front

Hello,

I've been playing with aux/wacom and aux/tablet on x61t.
aux/tablet often crashes with a `no concurrent reads, please'
error mid-drawing.  From what I can tell both of these
programs are early 9front additions.  Has anyone else seen
these errors?

I think that the issue is that nothing prevents the .req
field of each Reader from being modified at the same time
as a read(2) comes in, so at some point a new read could
check the field before sendout() can clear it.  The patch
below seems to work.

What do you think?

Thanks,
qwx


diff 69249e8313fb8853c5c162dd16b927099e25bb15 uncommitted
--- a//sys/src/cmd/aux/wacom.c
+++ b//sys/src/cmd/aux/wacom.c
@@ -303,11 +303,13 @@
 		reply(req, m);
 		msgdecref(m);
 	} else {
+		lock(&readers);
 		if(r->req) {
 			respond(req, "no concurrent reads, please");
 		} else {
 			r->req = req;
 		}
+		unlock(&readers);
 	}
 }
 

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-12-15  0:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-06  2:50 [9front] aux/wacom: possible race qwx
2021-12-06  3:08 ` Stanley Lieber
2021-12-14 23:55 ` qwx
2021-12-15  0:00   ` Stanley Lieber

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).