From: "Russ Cox" <rsc@plan9.bell-labs.com>
To: 9fans@cse.psu.edu
Subject: Re: [9fans] libthread help ...
Date: Tue, 31 Dec 2002 23:35:11 -0500 [thread overview]
Message-ID: <139f376dbb00f86c77be49c96b3abfc0@plan9.bell-labs.com> (raw)
In-Reply-To: <5.2.0.9.0.20021231213353.00a88ec0@pop.noos.fr>
if you run acid -l thread, it loads some
useful functions. one such function is
"stacks()", which prints the stack for all
the threads in all the procs of the program.
if you run this on your program, you see
(i've deleted all but the relevant lines):
acid: stacks()
------
threadmain:
0x00022328 1 Rendezvous alt(tag(*148068=0) 0: send(channel(223368)))
sendul(c=0x00036888,v=0x00000002) /sys/src/libthread/channel.c:231
called from threadmain+0x254 /tmp/a.c:106
------
mouseproc:
0x000366c8 2 Rendezvous alt(tag(*240176=0) 0: send(channel(222792)))
send(c=0x00036648,v=0x0003aab4) /sys/src/libthread/channel.c:209
called from _ioproc+0x149 /sys/src/libdraw/mouse.c:85
------
0x00036788 3 Rendezvous alt(tag(*244856=0) 0: send(channel(223048)))
sendul(c=0x00036748,v=0x00000001) /sys/src/libthread/channel.c:231
called from clockproc+0x63 /tmp/a.c:25
------
0x000368c8 4 Rendezvous alt(tag(*249380=0) 0: send(channel(223304)))
sendul(c=0x00036848,v=0x00000000) /sys/src/libthread/channel.c:231
called from menuhitproc+0xad /tmp/a.c:57
------
the problem is that the menuhitproc and main are
both reading from the mouse. main got a new mouse
event to send to menuhitproc, and menuhitproc is
trying to send its result to main at the same time.
perhaps you should wait for the menuhitproc to
send its result before waiting for more mouse ops.
you could change a[0].op to CHANNOP after sending
to menuhitproc and then change it back after getting
the result.
i don't see why it's a separate proc. you might want
main not to stop processing clock ticks while you
wait for the menu event, i guess, but even then you
could do that with a thread rather than a proc.
russ
next prev parent reply other threads:[~2003-01-01 4:35 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-12-31 20:48 Philippe Anel
2003-01-01 4:35 ` Russ Cox [this message]
2003-01-01 13:45 ` Philippe Anel
2003-01-01 17:00 ` Russ Cox
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=139f376dbb00f86c77be49c96b3abfc0@plan9.bell-labs.com \
--to=rsc@plan9.bell-labs.com \
--cc=9fans@cse.psu.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).