9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: dvd@davidashen.net
To: 9fans@cse.psu.edu
Subject: Re: [9fans] qunlock
Date: Thu, 24 Jun 2004 15:58:49 +0500	[thread overview]
Message-ID: <b4b080851299e6d9b095d97cb2b7f834@davidashen.net> (raw)
In-Reply-To: <ac681a2a7a84be85080152b19f4f1f54@plan9.escet.urjc.es>

> Maybe it's just that it's too early and I got soo few coffee, but,
> do meant this, didn't you?

No, I didn't; I mean that under certain condition each of the processes
steps aside and opens the way for the other one until the other one executes
at least once. 

The original code does exactly that.  Your changes just spin each of the processes once the corresponding condition becomes true.

> 
>> void
>> A()
>> {
> 
> 	qlock(a);
> againA:
> 
>> 	qlock(q);
>> 		if(x) {
>>    			qunlock(q);
>> 			goto againA;
>> 		}
> ....
> 
> 
>> void
>> B()
>> {
> 
>  	qlock(b);
> againB:
> 
>> 	qlock(q);
>> 		if(y){
>> 			qunlock(q);
>> 			goto againB;
>> 		}
> ....



  reply	other threads:[~2004-06-24 10:58 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-06-22  6:04 dvd
2004-06-22  8:06 ` C H Forsyth
2004-06-22  9:09   ` C H Forsyth
2004-06-22 14:19     ` ron minnich
2004-06-22 14:38       ` boyd, rounin
2004-06-22 15:13         ` Rob Pike
2004-06-23 20:11     ` dvd
2004-06-23 20:24       ` Rob Pike
2004-06-23 21:00         ` dvd
2004-06-23 21:12           ` boyd, rounin
2004-06-24  7:19           ` Fco. J. Ballesteros
2004-06-24 10:58             ` dvd [this message]
2004-06-24  7:34           ` Fco. J. Ballesteros
2004-06-24 11:02             ` dvd
2004-06-24 11:14               ` Fco. J. Ballesteros
2004-06-24 12:18                 ` dvd
2004-06-24 13:09                   ` Fco. J. Ballesteros
2004-06-24 13:30                   ` Sape Mullender
2004-06-24 13:47                   ` boyd, rounin
2004-06-24 13:42               ` boyd, rounin

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=b4b080851299e6d9b095d97cb2b7f834@davidashen.net \
    --to=dvd@davidashen.net \
    --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).