From: Pavel Machek <pavel@ucw.cz>
To: Hillf Danton <dhillf@gmail.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH v0] add nano semaphore in kernel
Date: Tue, 4 Jan 2011 15:03:55 +0100 [thread overview]
Message-ID: <20110104140355.GA1707@ucw.cz> (raw)
In-Reply-To: <AANLkTim0Xmsnzz5yMLAx_+w-c7sSSReu0SKMAmjpbS+1@mail.gmail.com>
Hi!
> +/*
> + * nano_semaphore_down - acquire the nano semaphore
> + * @s: the nano semaphore to be acquired
> + * @nano_secs: the nano seconds to wait if necessary,
> + * could be zero if want to wait as long as possible.
> + *
> + * Returns >0 if acquired successfully, <=0 otherwise.
> + *
> + * Note unlike down() in semaphore, nano_semaphore_down is not looping until
> + * the nano semaphore is hold, but simply reports the result. And the callers
> + * could, if they like, loop in simple manner, for instance,
> + * while (1 != nano_semaphore_down(s, 800));
> + * do_home_work();
> + * nano_semaphore_up(s);
But thats spinlock, not semaphore, right?
Also, your example does not use the API right -- according to
description, 42 is correct 'semaphore acquired' reply...
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
next prev parent reply other threads:[~2011-01-04 14:04 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-12-26 5:13 [PATCH v0] add nano semaphore in kernel Hillf Danton
2010-12-26 6:46 ` Rakib Mullick
2010-12-26 7:04 ` Hillf Danton
2010-12-26 9:08 ` Rakib Mullick
2010-12-26 12:05 ` Hillf Danton
2010-12-26 12:56 ` Rakib Mullick
2010-12-27 14:04 ` Hillf Danton
2010-12-27 20:08 ` Randy Dunlap
2010-12-29 14:57 ` Hillf Danton
2010-12-27 21:15 ` Arnd Bergmann
2010-12-28 13:13 ` Hillf Danton
2010-12-28 15:51 ` Daniel Walker
2010-12-29 11:47 ` Arnd Bergmann
2010-12-29 14:42 ` Hillf Danton
2010-12-29 14:58 ` Daniel Walker
2010-12-29 15:03 ` Hillf Danton
2010-12-29 19:16 ` Arnd Bergmann
2010-12-30 14:21 ` Hillf Danton
2010-12-30 15:56 ` Arnd Bergmann
2011-01-04 14:03 ` Pavel Machek [this message]
2011-01-04 14:18 ` Hillf Danton
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=20110104140355.GA1707@ucw.cz \
--to=pavel@ucw.cz \
--cc=dhillf@gmail.com \
--cc=linux-kernel@vger.kernel.org \
/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