From owner-freebsd-hackers@FreeBSD.ORG Tue Nov 1 16:05:41 2005 Return-Path: X-Original-To: freebsd-hackers@freebsd.org Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 894D016A41F for ; Tue, 1 Nov 2005 16:05:41 +0000 (GMT) (envelope-from imp@bsdimp.com) Received: from harmony.bsdimp.com (vc4-2-0-87.dsl.netrack.net [199.45.160.85]) by mx1.FreeBSD.org (Postfix) with ESMTP id 268BD43D62 for ; Tue, 1 Nov 2005 16:05:41 +0000 (GMT) (envelope-from imp@bsdimp.com) Received: from localhost (localhost.village.org [127.0.0.1] (may be forged)) by harmony.bsdimp.com (8.13.3/8.13.3) with ESMTP id jA1G22sX020660; Tue, 1 Nov 2005 09:02:02 -0700 (MST) (envelope-from imp@bsdimp.com) Date: Tue, 01 Nov 2005 09:02:12 -0700 (MST) Message-Id: <20051101.090212.05878607.imp@bsdimp.com> To: dinesh@alphaque.com From: "M. Warner Losh" In-Reply-To: <43676121.4030801@alphaque.com> References: <20051027.205250.55834228.imp@bsdimp.com> <4361E3E0.4090409@alphaque.com> <43676121.4030801@alphaque.com> X-Mailer: Mew version 3.3 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-2.0 (harmony.bsdimp.com [127.0.0.1]); Tue, 01 Nov 2005 09:02:02 -0700 (MST) Cc: freebsd-hackers@freebsd.org, scottl@samsco.org Subject: Re: locking in a device driver X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Nov 2005 16:05:41 -0000 In message: <43676121.4030801@alphaque.com> Dinesh Nair writes: : : : On 10/28/05 16:40 Dinesh Nair said the following: : > : > : > On 10/28/05 10:52 M. Warner Losh said the following: : > : >> libc_r will block all other threads in the application while an ioctl : >> executes. libpthread and libthr won't. I've had several bugs at work : > : > : > which is a Good Thing(tm) indeed for me on 4.x. : : which may not be a Good Thing(tm) after all. this could be causing the : problem i'm seeing with the driver on 4.x. any methods to get around this, : short of not using threads ? Use non-blocking I/O + read/write channels + select/poll instead of ioctl for things you want to block. Your thread can then read/write to that channel, and since the treading package does the select behind the scenes, it will be good for you. Warner