From owner-freebsd-hackers@FreeBSD.ORG Thu Sep 29 16:55:45 2005 Return-Path: X-Original-To: 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 768AA16A41F for ; Thu, 29 Sep 2005 16:55:45 +0000 (GMT) (envelope-from xdivac02@stud.fit.vutbr.cz) Received: from eva.fit.vutbr.cz (eva.fit.vutbr.cz [147.229.10.14]) by mx1.FreeBSD.org (Postfix) with ESMTP id C6AED43D48 for ; Thu, 29 Sep 2005 16:55:43 +0000 (GMT) (envelope-from xdivac02@stud.fit.vutbr.cz) Received: from eva.fit.vutbr.cz (localhost [127.0.0.1]) by eva.fit.vutbr.cz (envelope-from xdivac02@eva.fit.vutbr.cz) (8.13.4/8.13.3) with ESMTP id j8TGtcji021257 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NO) for ; Thu, 29 Sep 2005 18:55:38 +0200 (CEST) Received: (from xdivac02@localhost) by eva.fit.vutbr.cz (8.13.4/8.13.3/Submit) id j8TGtcWc021256 for hackers@freebsd.org; Thu, 29 Sep 2005 18:55:38 +0200 (CEST) Date: Thu, 29 Sep 2005 18:55:38 +0200 From: Divacky Roman To: hackers@freebsd.org Message-ID: <20050929165538.GA20614@stud.fit.vutbr.cz> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4.2i X-Scanned-By: MIMEDefang 2.49 on 147.229.10.14 Cc: Subject: dev_lock() question 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: Thu, 29 Sep 2005 16:55:45 -0000 Hi, dev_lock() looks this way: void dev_lock(void) { if (!mtx_initialized(&devmtx)) mtx_init(&devmtx, "cdev", NULL, MTX_DEF); mtx_lock(&devmtx); } I wonder why is the mtx_initialized checking necessary? shouldnt explicit initialization be sufficient? thnx for answer roman