This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH, newlib] Allow locking routine to be retargeted


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:
+#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?

I'm thinking that the lock also needs to be weakly defined so that there is no link failure on single threaded environment.

Best regards,

Thomas


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]