From owner-freebsd-hackers@FreeBSD.ORG Thu Mar 19 06:33:10 2015 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9A245656 for ; Thu, 19 Mar 2015 06:33:10 +0000 (UTC) Received: from mail-wi0-x235.google.com (mail-wi0-x235.google.com [IPv6:2a00:1450:400c:c05::235]) (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 4814ED49 for ; Thu, 19 Mar 2015 06:33:10 +0000 (UTC) Received: by wibdy8 with SMTP id dy8so108913388wib.0 for ; Wed, 18 Mar 2015 23:33:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject :content-type:content-transfer-encoding; bh=ROeL5xwCNFw5X9ppxqQeFDZOPKeekTI7o/3+MQbGAjM=; b=RI7rwaQvE3dJ6N1wRbkAVTQVOAyjzOIQySoJ9i5kDjF9lQhced+mk5rkhoARqK6GrT 06lig+RpzkpWRNII8hJPXiConeSqeuqcQ+3jYtIB5WKZJ6LUYKnzLMNXWIb5KqOWFi1d axh1kGTJrMVbBhpvcat9culUtSfcAqV/freIRFF4PrU7nbFmO2OzG+3ZPYkyqaKBJbuM ppMmKxF22HI+iN2Vb+lMrdwqa/O09wqhVkG6tS5BDySt/z5vXq+fJlswq326+2kJSuUu 5XIyircaRUIUzuVNpmQVvjCeYSxxwJjeHNA7D17Zj5fcPGOoRkQAJjPd08CZ2jGIMbBH i93A== X-Received: by 10.180.98.131 with SMTP id ei3mr13236118wib.62.1426746788529; Wed, 18 Mar 2015 23:33:08 -0700 (PDT) Received: from zmaj.softwarehood.com (212-200-205-182.dynamic.isp.telekom.rs. [212.200.205.182]) by mx.google.com with ESMTPSA id lu13sm1094701wic.10.2015.03.18.23.33.07 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 18 Mar 2015 23:33:07 -0700 (PDT) Message-ID: <550A6DA2.1070004@gmail.com> Date: Thu, 19 Mar 2015 07:33:06 +0100 From: Ivan Radovanovic User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:17.0) Gecko/20130812 Thunderbird/17.0.8 MIME-Version: 1.0 To: freebsd-hackers@FreeBSD.org Subject: kevent behavior Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Mar 2015 06:33:10 -0000 Hi guys, Is there defined (and guaranteed) behavior of kevent if kqueue FD is being closed while blocking kevent call is in progress? Possible scenario would be like this: Thread 1: ... kfd = kqueue(); ... // create second thread afterwords // and do blocking wait for events result = kevent(kfd, changelist, nchanges, eventlist, nevents, NULL); if (result == -1) // check if there was request to stop listening for events Thread 2: // do something // then close kqueue's fd close(kfd); I am asking this because file watcher implementation for mono is implemented that way (which I find nicer than using timeout), but this is apparently based on expected kevent behavior under Darwin, and I can't find any mention that in FreeBSD kevent is going to behave the same way (at least not on kqueue(2) manual page) Kind regards, Ivan