[PATCH, newlib] Allow locking routine to be retargeted
Wed Dec 14 14:52:00 GMT 2016
On 14/12/16 14:36, Thomas Preudhomme wrote:
> On 14/12/16 14:21, Sebastian Huber wrote:
>> On 13/12/16 18:18, Thomas Preudhomme wrote:
>>> +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?
I'm thinking that the lock also needs to be weakly defined so that there is no
link failure on single threaded environment.
More information about the Newlib