public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@osdl.org>
To: Matthew Wilcox <willy@debian.org>
Cc: umka@namesys.com, acpi-devel@lists.sourceforge.net,
	linux-kernel@vger.kernel.org
Subject: Re: down_timeout
Date: Fri, 3 Oct 2003 13:36:32 -0700	[thread overview]
Message-ID: <20031003133632.4b8cd1bc.akpm@osdl.org> (raw)
In-Reply-To: <20031003142518.GN24824@parcelfarce.linux.theplanet.co.uk>

Matthew Wilcox <willy@debian.org> wrote:
>
> /* Returns -EINTR if the timeout expires */
> int down_timeout(struct semaphore *sem, long timeout)
> {
> 	struct timer_list timer;
> 	int result;
> 
> 	init_timer(&timer);
> 	timer.expires = timeout + jiffies;
> 	timer.data = (unsigned long) current;
> 	timer.function = process_timeout;
> 
> 	add_timer(&timer);
> 	result = down_interruptible(sem);
> 	del_timer_sync(&timer);
> 
> 	return result;
> }

down_interruptible() will only break out if signal_pending(current), so the
wakeup-on-expiry here will not work as desired.

New per-arch primitives would be needed to implement this, I think.


  reply	other threads:[~2003-10-03 20:36 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <3F7D6DA1.9070801@namesys.com>
2003-10-03 14:25 ` down_timeout Matthew Wilcox
2003-10-03 20:36   ` Andrew Morton [this message]
2003-10-03 18:03 down_timeout Grover, Andrew
2003-10-04  7:53 ` down_timeout Ingo Oeser
  -- strict thread matches above, loose matches on Subject: below --
2001-04-26 16:27 down_timeout Moore, Robert
2001-04-25 23:21 down_timeout Grover, Andrew
2001-04-25 23:49 ` down_timeout Ingo Oeser

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=20031003133632.4b8cd1bc.akpm@osdl.org \
    --to=akpm@osdl.org \
    --cc=acpi-devel@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=umka@namesys.com \
    --cc=willy@debian.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