From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18559 invoked by alias); 14 Dec 2016 14:36:58 -0000 Mailing-List: contact newlib-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: newlib-owner@sourceware.org Received: (qmail 18526 invoked by uid 89); 14 Dec 2016 14:36:57 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-4.0 required=5.0 tests=BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=H*f:sk:5851557, H*i:sk:5851557, class_LOCK_T, class_lock_t X-HELO: foss.arm.com Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 14 Dec 2016 14:36:56 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 48376152D; Wed, 14 Dec 2016 06:36:55 -0800 (PST) Received: from [10.2.206.52] (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id EE5433F220 for ; Wed, 14 Dec 2016 06:36:54 -0800 (PST) Subject: Re: [PATCH, newlib] Allow locking routine to be retargeted To: newlib@sourceware.org References: <34e2c2ad-be0f-44ed-201e-a6f294814f4e@foss.arm.com> <5851557A.4080707@embedded-brains.de> From: Thomas Preudhomme Message-ID: <800fa569-cd83-bd61-95e3-7ad83e053d6c@foss.arm.com> Date: Wed, 14 Dec 2016 14:36:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 MIME-Version: 1.0 In-Reply-To: <5851557A.4080707@embedded-brains.de> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2016/txt/msg01173.txt.bz2 On 14/12/16 14:21, Sebastian Huber wrote: > > > On 13/12/16 18:18, Thomas Preudhomme wrote: >> +#else >> + >> +typedef void * _LOCK_T; >> +#define _LOCK_RECURSIVE_T _LOCK_T >> + >> +#define __LOCK_INIT(class,lock) extern struct_lock _lock_ ## lock; \ >> + class_LOCK_T lock = &_lock_ ## lock >> +#define __LOCK_INIT_RECURSIVE(class,lock) __LOCK_INIT(class,lock) > > I would use: > > struct _lock; > typedef struct _lock *_LOCK_T; > > This makes debugging a bit easier. But then if your lock is just an integer you have to use a structure with a single field, right? Why is struct _lock easier to debug by the way? Best regards, Thomas