From owner-freebsd-current@freebsd.org Wed Jul 1 22:30:00 2015 Return-Path: Delivered-To: freebsd-current@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 20FC0992A4B for ; Wed, 1 Jul 2015 22:30:00 +0000 (UTC) (envelope-from jfvogel@gmail.com) Received: from mail-wi0-x22c.google.com (mail-wi0-x22c.google.com [IPv6:2a00:1450:400c:c05::22c]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id AC70C25B6 for ; Wed, 1 Jul 2015 22:29:59 +0000 (UTC) (envelope-from jfvogel@gmail.com) Received: by wiga1 with SMTP id a1so137608179wig.0 for ; Wed, 01 Jul 2015 15:29:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=tOwHJmMXdz5qreXlSLeD4CPDzSgkFVU/oaQdXS8RBIY=; b=Pc075jvaVyKAah9yyS1PyeZj5TUqafg5c5GJmOPDxwcd1BKZE5Ruvg32MY+noEkx0F gv+eusLHHTHnkCuOOFi8xO1r0rdIF/dH00iqC4jr9mOUfc8mNwB09K7H0h0byuvBBchq shS9noiPXy49UFOE/jxHgFLOedgQ/tO06TByiKeUsQADWGXm/pg8W0zVe18s7m2t86O0 XE09WGXcsNwQwWilhqeimzjdzcwnb26CDo6IR9vJn2FIhQqzJXKzZtdUn+T+OP4k1dI3 Wz7engzMNizYKP3dom2IYsGy9hDOUvSrSV1jOdcdaOhSvczmAtVF074bp6v08dBKG3yh Xiuw== MIME-Version: 1.0 X-Received: by 10.180.20.15 with SMTP id j15mr10619513wie.76.1435789797925; Wed, 01 Jul 2015 15:29:57 -0700 (PDT) Received: by 10.194.248.163 with HTTP; Wed, 1 Jul 2015 15:29:57 -0700 (PDT) In-Reply-To: References: <20150701213241.GG2080@kib.kiev.ua> Date: Wed, 1 Jul 2015 15:29:57 -0700 Message-ID: Subject: Re: How should a driver shutdown a taskqueue on detach? From: Jack Vogel To: Ryan Stone Cc: Konstantin Belousov , FreeBSD Current Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.20 X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Jul 2015 22:30:00 -0000 Ya, that seems elegant. Jack On Wed, Jul 1, 2015 at 3:28 PM, Ryan Stone wrote: > On Wed, Jul 1, 2015 at 5:32 PM, Konstantin Belousov > wrote: > >> Do you mean, you want some KPI like >> boolean taskqueue_is_draining(struct taskqueue *p); >> so that e.g. executed task could see if it is executing in the >> shutdown state ? > > > I'd prefer a KPI that stops a taskqueue from accepting new tasks (and > drops attempts to enqueue on the floor). Then I could do something like: > > taskqueue_stop() > disable_interrupts() > taskqueue_drain_all() > taskqueue_free() >