From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4911 invoked by alias); 11 Jul 2005 07:52:54 -0000 Mailing-List: contact ecos-discuss-help@ecos.sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: ecos-discuss-owner@ecos.sourceware.org Received: (qmail 4899 invoked by uid 22791); 11 Jul 2005 07:52:51 -0000 Received: from nproxy.gmail.com (HELO nproxy.gmail.com) (64.233.182.196) by sourceware.org (qpsmtpd/0.30-dev) with ESMTP; Mon, 11 Jul 2005 07:52:51 +0000 Received: by nproxy.gmail.com with SMTP id d4so186509nfe for ; Mon, 11 Jul 2005 00:52:48 -0700 (PDT) Received: by 10.48.143.11 with SMTP id q11mr126053nfd; Mon, 11 Jul 2005 00:52:48 -0700 (PDT) Received: by 10.48.43.13 with HTTP; Mon, 11 Jul 2005 00:52:48 -0700 (PDT) Message-ID: <69dd805e05071100527149ccaa@mail.gmail.com> Date: Mon, 11 Jul 2005 07:52:00 -0000 From: Fabian Scheler Reply-To: Fabian Scheler To: "Paul D. DeRocco" Cc: eCos Discuss In-Reply-To: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <20050708140827.GA2640@lunn.ch> Subject: Re: [ECOS] Mutex & Asserts during initialisation X-SW-Source: 2005-07/txt/msg00097.txt.bz2 Hi, > > Humm, i think this is reasonable behaviour. Anything that tries to use > > a mutex must assume it can block. Otherwise why are you using a mutex! well, this is a reasonable solution, > I can see the other side of this. You want to write a driver that can work > in a multi-threaded environment, so you include a mutex in it. But then y= ou > want to call it from startup code. Rather than write a second specialized > non-multi-threaded driver, or include some sort of flag that tells it to > skip the locking and unlocking, it's much cleaner to simply consider the > attempt to lock a mutex before the threading system has been initialized a > harmless null operation. while this is not. You better should design your driver properly, so it can cooperate with the operating system, the driver is developed for, not vice versa. Within a clean layered software design it just means to add one more layer to make your driver thread safe! During startup you can still use a layer where no thread synchronization is necessary. You can add this new layer with the help of C++ inline-functions in a very efficient manner, for example. Another possibility is to use AOP for this purpose, compare "Using AOP to Develop Archtiecture-Neutral Operating System Components" (Spinczyk+Lohmann), for instance. Ciao, Fabian -- Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss