From owner-freebsd-hackers@FreeBSD.ORG Fri Dec 24 12:13:37 2004 Return-Path: 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 05FE316A4CE for ; Fri, 24 Dec 2004 12:13:37 +0000 (GMT) Received: from linux01.gwdg.de (linux01.gwdg.de [134.76.13.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4933B43D58 for ; Fri, 24 Dec 2004 12:13:36 +0000 (GMT) (envelope-from jengelh@linux01.gwdg.de) Received: from linux01.gwdg.de (localhost [127.0.0.1])iBOCDZrg024759 for ; Fri, 24 Dec 2004 13:13:35 +0100 Received: from localhost (jengelh@localhost) by linux01.gwdg.de (8.12.7/8.12.7/Submit) with ESMTP id iBOCDY0B024754 for ; Fri, 24 Dec 2004 13:13:34 +0100 Date: Fri, 24 Dec 2004 13:13:34 +0100 (MET) From: Jan Engelhardt Cc: freebsd-hackers@freebsd.org In-Reply-To: Message-ID: References: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Subject: Re: Kernel crash w/o reason X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Dec 2004 12:13:37 -0000 >> What should I use instead? A semaphore? >You shouldn't have unrelated kernel threads waiting for a user >process at all, so this sounds like a design problem, regardless >of which mutual exclusion primitive you use. (Bear in mind that I >haven't actually looked into what you're trying to do.) In any >case, you can always use mutexes to implement whatever other >synchronization mechanism you need. I wanted that the device can only be opened once, and holding a mutex while it is open seemed like a simple idea. (Since mtx_trylock() will then fail -- easy to implement.)