From owner-freebsd-hackers@FreeBSD.ORG Mon Mar 18 10:44:49 2013 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 689DA10FD for ; Mon, 18 Mar 2013 10:44:49 +0000 (UTC) (envelope-from sebastian.huber@embedded-brains.de) Received: from mail.embedded-brains.de (host-82-135-62-35.customer.m-online.net [82.135.62.35]) by mx1.freebsd.org (Postfix) with ESMTP id 256042E6 for ; Mon, 18 Mar 2013 10:44:48 +0000 (UTC) Received: by mail.embedded-brains.de (Postfix, from userid 65534) id 2866A652CFE; Mon, 18 Mar 2013 09:19:03 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on fidibusdmz X-Spam-Level: X-Spam-Status: No, score=-4.0 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.5 Received: from [192.168.96.64] (eb0024.eb.z [192.168.96.64]) by mail.embedded-brains.de (Postfix) with ESMTP id 07D06652CFC; Mon, 18 Mar 2013 09:19:02 +0100 (CET) Message-ID: <5146CDF5.3070308@embedded-brains.de> Date: Mon, 18 Mar 2013 09:19:01 +0100 From: Sebastian Huber User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130105 Thunderbird/17.0.2 MIME-Version: 1.0 To: Ryan Stone Subject: Re: Purpose of kqueue_task? References: <51435063.7050907@embedded-brains.de> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit Cc: FreeBSD Hackers X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Mar 2013 10:44:49 -0000 On 03/15/2013 06:19 PM, Ryan Stone wrote: > On Fri, Mar 15, 2013 at 12:46 PM, Sebastian Huber > > wrote: > > Hello, > > I want to port the FreeBSD kqueue implementation to another operating > system (RTEMS in this case) to improve the Erlang support. > > I have difficulties to understand the purpose of the kqueue_task. This > function runs asynchronously. It obtains some locks and wakes up the > normal kqueue channel if (kq->kq_state & KQ_TASKDRAIN) == KQ_TASKDRAIN. > This state is only set in kqueue_close(). So most of the time the > kqueue_task only obtains some locks, clears a flag (KQ_TASKSCHED) and > releases the locks? > > > You missed the most important thing that it does: it calls KNOTE_LOCKED to wake > up any waiters sleeping on this event. I suspect that it had to be done in a > separate task due to lock ordering problems with the kq_global lock. Oh, I was blind. This KNOTE_LOCKED looked more like an assertion to me. -- Sebastian Huber, embedded brains GmbH Address : Dornierstr. 4, D-82178 Puchheim, Germany Phone : +49 89 189 47 41-16 Fax : +49 89 189 47 41-09 E-Mail : sebastian.huber@embedded-brains.de PGP : Public key available on request. Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.