From: "Francisco J Ballesteros" <nemo@lsub.org>
To: "Fans of the OS Plan 9 from Bell Labs" <9fans@cse.psu.edu>
Subject: Re: [9fans] does qlock(2) block all threads on a proc?
Date: Fri, 10 Aug 2007 18:16:40 +0200 [thread overview]
Message-ID: <8ccc8ba40708100916o5bdf7c3eof067224764c06fd0@mail.gmail.com> (raw)
In-Reply-To: <c58b317a0708091714n4deef948g47b7f2e0cada34e0@mail.gmail.com>
It's a queueing lock, but otherwise just a lock. Thus, you use it like
lock(), that is
qlock(&l);
...isolated access to your shared data...
qunlock(&l);
The difference wrt lock/unlock is that it does not spin. If the lock
cannot be set, the
thread is put to sleep in queue waiting for the lock. So, it's better
to use qlock in
general than it is to use lock. (IIRC, lock is used to protect the
data structure of the QLock,
that might give you more insight regarding the difference b/w qlock and lock).
hth
On 8/10/07, david jeannot <djeannot24@gmail.com> wrote:
> Hi,
>
> Does qlock block all threads on a same proc?
> I read lock(2) and thread(2) but I am not sure yet.
>
> Merci beaucoup, david
>
next prev parent reply other threads:[~2007-08-10 16:16 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-08-10 0:14 david jeannot
2007-08-10 0:26 ` Kris Maglione
2007-08-10 1:56 ` erik quanstrom
2007-08-10 16:16 ` Francisco J Ballesteros [this message]
2007-08-10 16:30 ` erik quanstrom
2007-08-10 18:37 ` Francisco J Ballesteros
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=8ccc8ba40708100916o5bdf7c3eof067224764c06fd0@mail.gmail.com \
--to=nemo@lsub.org \
--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).