From owner-freebsd-arch Sun May 14 1: 4: 0 2000 Delivered-To: freebsd-arch@freebsd.org Received: from finch-post-12.mail.demon.net (finch-post-12.mail.demon.net [194.217.242.41]) by hub.freebsd.org (Postfix) with ESMTP id C8BDF37B52B for ; Sun, 14 May 2000 01:03:56 -0700 (PDT) (envelope-from dfr@nlsystems.com) Received: from nlsys.demon.co.uk ([158.152.125.33] helo=herring.nlsystems.com) by finch-post-12.mail.demon.net with esmtp (Exim 2.12 #1) id 12qtNT-0004rI-0C; Sun, 14 May 2000 08:03:55 +0000 Received: from salmon.nlsystems.com (salmon.nlsystems.com [10.0.0.3]) by herring.nlsystems.com (8.9.3/8.8.8) with ESMTP id JAA04144; Sun, 14 May 2000 09:08:03 +0100 (BST) (envelope-from dfr@nlsystems.com) Date: Sun, 14 May 2000 09:08:20 +0100 (BST) From: Doug Rabson To: Chuck Paterson Cc: arch@freebsd.org Subject: Re: A new api for asynchronous task execution In-Reply-To: <200005132342.RAA01739@berserker.bsdi.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Sat, 13 May 2000, Chuck Paterson wrote: > > } > }The system defines specific implementations of queues which are drained at > }particular times (initially I have defined one using SWI). I want to make > }it as easy as possible to define different lightweight queues for various > }types of work. The 'enqueue' function pointer in the taskqueue structure > }defines the run policy for the queue. > } > > I would agree that there is no reason to change what you > have for generic queueing. But for taskqueue_swi currently > and a possibly others in the future you not only need to > queue the event you want to cause a software interrupt to occur > at the soonest reasonable time. Putting the item on the work > queue does not seem sufficient. In particular I would argue the > following should be avoided > > > taskqueue_enqueue(struct taskqueue *queue, struct task *task) > { > int s = splhigh(); > > /* > * Count multiple enqueues. > */ > if (task->pending) { > task->pending++; > return; > } > STAILQ_INSERT_TAIL(&queue->queue, task, link); > task->pending = 1; > if (queue->enqueue) > queue->enqueue(queue); > > if (queueu == taskqueue_swi) <------ > setsoftaskqueue(); <------ For taskqueue_swi, this is exactly what happens in the call to queue->enqueue(queue) above. -- Doug Rabson Mail: dfr@nlsystems.com Nonlinear Systems Ltd. Phone: +44 20 8442 9037 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message