From owner-freebsd-doc@FreeBSD.ORG Fri Jan 24 10:48:48 2014 Return-Path: Delivered-To: www@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 35A44F16 for ; Fri, 24 Jan 2014 10:48:48 +0000 (UTC) Received: from mail-oa0-x248.google.com (mail-oa0-x248.google.com [IPv6:2607:f8b0:4003:c02::248]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 01DEF1F8B for ; Fri, 24 Jan 2014 10:48:47 +0000 (UTC) Received: by mail-oa0-f72.google.com with SMTP id i4so11586896oah.7 for ; Fri, 24 Jan 2014 02:48:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:message-id:date:subject:from:to:content-type; bh=Is8yQVyD82lGso9XzmK8PNI2h9dHkF357huvTExUMzI=; b=EhuvrxASWuaOwA5lEvTYD5vxd9ycHqoEsVI4yPflHvXNgCSRbA58SBRadr/J/wXMMx 7VkkwQSs0mtgI+t7TQjKYGBuJBgqOE6GilWTlwqSG64ovlPmUVA+mGzdb7cG8JDQqvbG wS+62J/pq9thECz2MkhGFWIkAxqkXFEW5fGemat0UDWns4KI0v3Lo8pkYPUNZP1qAnUz NP0LPzOtDcbJFSNWd0UDE4BVHKfgg+beh/yZSJAa3qAmsazApJ4ZuSmeYIYyESngj9xM A7m6yW9za73PGguH17M+9gR/pdStgDlozNp2rbL/1xC6a0ubdccLYsvoSa4lNhOvnbGY 8YSg== MIME-Version: 1.0 X-Received: by 10.50.18.4 with SMTP id s4mr1634689igd.5.1390560527341; Fri, 24 Jan 2014 02:48:47 -0800 (PST) Message-ID: <089e013cb8d6455f3504f0b51a6f@google.com> Date: Fri, 24 Jan 2014 10:48:47 +0000 Subject: www.freebsd.org From: Veronica Yuen To: www@freebsd.org Content-Type: text/plain; charset=windows-1252; format=flowed; delsp=yes Content-Transfer-Encoding: base64 X-Content-Filtered-By: Mailman/MimeDel 2.1.17 X-BeenThere: freebsd-doc@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: Documentation project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Jan 2014 10:48:48 -0000 PGRpdiBkaXI9Imx0ciI+PHA+SGksPC9wPjxkaXY+PHA+SSB3YW50ZWQgdG8gc2VuZCB5b3UgYSBx dWljayBub3RlLiBXaXRoIGEgIA0KZmV3IHNpbXBsZSBjaGFuZ2VzIHRvIG1ha2UgeW91ciBzaXRl IG1vcmUgU0VPLWZyaWVuZGx5IEmSbSBzdXJlIHlvdSBjYW4gIA0KY29udmVydCBtb3JlIHZpc2l0 b3JzIGludG8gbGVhZHMgYW5kIGdldCBpdCBwbGFjZWQgaGlnaGVyIGluIHRoZSBvcmdhbmljICAN CnNlYXJjaCByZXN1bHRzLCBmb3Iga2V5d29yZHMgdGhhdCBtYXR0ZXIgdG8geW91IHRoZSBtb3N0 LjwvcD4NCg0KDQo8L2Rpdj48ZGl2PjxwPldlIGFyZSBhIExvY2FsIGJhc2VkIGNvbXBhbnkgd2l0 aCBncmVhdCBpbi1ob3VzZSB0ZWNobmljYWwgIA0KdGVhbSB3aG8gcmVhbGx5IGtub3cgdGhlaXIg c3R1ZmYgYWJvdXQgc2VhcmNoIGVuZ2luZSAgDQpvcHRpbWl6YXRpb24uoDwvcD48L2Rpdj48cD5X b3VsZCB5b3UgbGlrZSBhIGJpdCBtb3JlIGluZm9ybWF0aW9uIGFib3V0IGhvdyAgDQp0byBnaXZl IHlvdXIgd2Vic2l0ZSBhIGJvb3N0IHdpdGggYmV0dGVyIFNFTz88L3A+DQoNCg0KPHA+QmVzdCBy ZWdhcmRzLDwvcD48cD48c3BhbiBzdHlsZT0iZm9udC1mYW1pbHk6JiM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GVkIHBob25lIHRlY2hub2xvZ3kgdG8gY2FsbCB5b3Uu IEF0IG5vICANCnRpbWUgYXJlIHlvdSByZXF1aXJlZCB0byBtYWtlIGEgcHVyY2hhc2UuPC9zcGFu PjwvcD4NCg0KDQo8ZGl2IHN0eWxlPSJ0ZXh0LWFsaWduOmNlbnRlciI+PHNwYW4gIA0Kc3R5bGU9 ImZvbnQtZmFtaWx5OmFyaWFsLGhlbHZldGljYSxzYW5zLXNlcmlmO2ZvbnQtc2l6ZTp4eC1zbWFs bDtjb2xvcjpyZ2IoMTM2LDEzNiwxMzYpIj5VbnN1YnNjcmliZTwvc3Bhbj48L2Rpdj48L2Rpdj4N Cg== From owner-freebsd-doc@FreeBSD.ORG Fri Jan 24 14:16:37 2014 Return-Path: Delivered-To: doc@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 0A63917D; Fri, 24 Jan 2014 14:16:37 +0000 (UTC) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id 39092112B; Fri, 24 Jan 2014 14:16:35 +0000 (UTC) Received: from porto.starpoint.kiev.ua (porto-e.starpoint.kiev.ua [212.40.38.100]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id QAA11609; Fri, 24 Jan 2014 16:16:34 +0200 (EET) (envelope-from avg@FreeBSD.org) Received: from localhost ([127.0.0.1]) by porto.starpoint.kiev.ua with esmtp (Exim 4.34 (FreeBSD)) id 1W6hYg-0006By-1Q; Fri, 24 Jan 2014 16:16:34 +0200 Message-ID: <52E27589.8050302@FreeBSD.org> Date: Fri, 24 Jan 2014 16:15:37 +0200 From: Andriy Gapon User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 MIME-Version: 1.0 To: doc@FreeBSD.org Subject: taskqueue(9) manual page update References: <52D93F91.502@FreeBSD.org> In-Reply-To: <52D93F91.502@FreeBSD.org> X-Enigmail-Version: 1.6 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Cc: hackers@FreeBSD.org X-BeenThere: freebsd-doc@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: Documentation project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Jan 2014 14:16:37 -0000 [I intended to change the subject line and forgot, so this is a dupe.] I would like to commit the following manual page update. Could you please review it? Thank you very much! -------- Original Message -------- Message-ID: <52D93F91.502@FreeBSD.org> Date: Fri, 17 Jan 2014 16:34:57 +0200 From: Andriy Gapon To: Justin T. Gibbs CC: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r258713 - in head/sys: kern sys References: <201311281856.rASIuZu8059699@svn.freebsd.org> <3784C560-3648-4E03-93DA-9A60E3AC401D@scsiguy.com> In-Reply-To: <3784C560-3648-4E03-93DA-9A60E3AC401D@scsiguy.com> on 30/11/2013 08:46 Justin T. Gibbs said the following: > Man page update? I came up with the following update that - adds taskqueue_drain_all documentation - extends taskqueue_drain description - adds description for previously undocumented taskqueue_block / taskqueue_unblock, including a warning on taskqueue_block + taskqueue_drain combination All reviews and suggestions are welcome. Both for content and language. diff --git a/share/man/man9/taskqueue.9 b/share/man/man9/taskqueue.9 index 5f6131a..4db3d7a 100644 --- a/share/man/man9/taskqueue.9 +++ b/share/man/man9/taskqueue.9 @@ -86,6 +86,12 @@ struct timeout_task; .Fn taskqueue_drain "struct taskqueue *queue" "struct task *task" .Ft void .Fn taskqueue_drain_timeout "struct taskqueue *queue" "struct timeout_task *timeout_task" +.Ft void +.Fn taskqueue_drain_all "struct taskqueue *queue" +.Ft void +.Fn taskqueue_block "struct taskqueue *queue" +.Ft void +.Fn taskqueue_unblock "struct taskqueue *queue" .Ft int .Fn taskqueue_member "struct taskqueue *queue" "struct thread *td" .Ft void @@ -255,6 +261,74 @@ function is used to wait for the scheduled task to finish. There is no guarantee that the task will not be enqueued after call to .Fn taskqueue_drain . +Because the caller typically would use +.Fn taskqueue_drain +to put the task into a known state, then the caller should use +out-of-band means to ensure, before calling +.Fn taskqueue_drain , +that the task would not be enqueued. +For example, if the task is enqueued by an interrupt filter, then +the interrupt could be disabled. +.Pp +The +.Fn taskqueue_drain_all +function is used to wait for all the pending and running tasks that +are enqueued on the taskqueue to finish. +The caller must arrange that the tasks are not re-enqueued. +Note that +.Fn taskqueue_drain_all +currently does not handle tasks with delayed enqueueing. +.Pp +The +.Fn taskqueue_block +function blocks the taskqueue. +It prevents any enqueued but not running tasks from being executed. +Future calls to +.Fn taskqueue_enqueue +will enqueue tasks, but the tasks will not be run until +.Fn taskqueue_unblock +is called. +Please note that +.Fn taskqueue_block +does not wait for any currently running tasks to finish. +Thus, the +.Fn taskqueue_block +does not provide a guarantee that +.Fn taskqueue_run +is not running after +.Fn taskqueue_block +returns, but it does provide a guarantee that +.Fn taskqueue_run +will not be called again +until +.Fn taskqueue_unblock +is called. +If the caller requires a guarantee that +.Fn taskqueue_run +is not running, then this must be arranged by the caller. +Note that if +.Fn taskqueue_drain +is called on a task that is enqueued on a taskqueue that is blocked by +.Fn taskqueue_block , +then +.Fn taskqueue_drain +can not return until the taskqueue is unblocked. +This can result in a deadlock if the thread blocked in +.Fn taskqueue_drain +is a thread that is supposed to call +.Fn taskqueue_unblock . +Thus, use of +.Fn taskqueue_drain +after +.Fn taskqueue_block +is discouraged, because a state of the task can not be known in advance. +The same applies to +.Fn taskqueue_drain_all . +.Pp +The +.Fn taskqueue_unblock +function unblocks the previously blocked taskqueue. +All enqueued tasks can be run after this call. .Pp The .Fn taskqueue_member -- Andriy Gapon