From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Morton Subject: Re: down_timeout Date: Fri, 3 Oct 2003 13:36:32 -0700 Sender: acpi-devel-admin-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org Message-ID: <20031003133632.4b8cd1bc.akpm@osdl.org> References: <3F7D6DA1.9070801@namesys.com> <20031003142518.GN24824@parcelfarce.linux.theplanet.co.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20031003142518.GN24824-+pPCBgu9SkPzIGdyhVEDUDl5KyyQGfY2kSSpQ9I8OhVaa/9Udqfwiw@public.gmane.org> Errors-To: acpi-devel-admin-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org List-Help: List-Post: List-Subscribe: , List-Unsubscribe: , List-Archive: To: Matthew Wilcox Cc: umka-nJ1KrdHEGnBBDgjK7y7TUQ@public.gmane.org, acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org List-Id: linux-acpi@vger.kernel.org Matthew Wilcox 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. ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf