From owner-freebsd-hackers Thu Aug 29 3:19:33 2002 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 5A1BF37B400 for ; Thu, 29 Aug 2002 03:19:31 -0700 (PDT) Received: from mailhub.fokus.gmd.de (mailhub.fokus.gmd.de [193.174.154.14]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2880F43E6E for ; Thu, 29 Aug 2002 03:19:30 -0700 (PDT) (envelope-from brandt@fokus.gmd.de) Received: from beagle (beagle [193.175.132.100]) by mailhub.fokus.gmd.de (8.11.6/8.11.6) with ESMTP id g7TAJR708270 for ; Thu, 29 Aug 2002 12:19:28 +0200 (MEST) Date: Thu, 29 Aug 2002 12:19:27 +0200 (CEST) From: Harti Brandt To: hackers@freebsd.org Subject: driver attach/detach functions Message-ID: <20020829121303.F381-100000@beagle.fokus.gmd.de> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Hi, while trying to get rid of 'could sleep with mutex' messages a question occured to me: is there any global mechanism that ensures that no two threads enter the interface attach/detach functions at the same time? If there is, there should be a hint in driver(9) probably. If there isn't what is the canonical way to implement an MP-safe attach function? Some drivers use foo_attach(...) { mtx_init(&sc->mtx, ... mtx_lock(&sc->mtx); ... but this really doesn't help. Regards, harti -- harti brandt, http://www.fokus.gmd.de/research/cc/cats/employees/hartmut.brandt/private brandt@fokus.gmd.de, brandt@fokus.fhg.de To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message