[PATCH, newlib] Allow locking routine to be retargeted

Freddie Chopin freddie_chopin@op.pl
Thu Nov 24 08:29:00 GMT 2016

On Thu, 2016-11-24 at 08:44 +0100, Sebastian Huber wrote:
> 3)
> struct _lock;
> typedef struct _lock *_LOCK_T;
> #define __LOCK_INIT(class, lock) extern struct _lock _lock_ ## lock;
> class _LOCK_T lock = &_lock_ ## lock;
> The OS must then provide struct _lock and storage for all statically
> initialized locks.

Good and simple, changes almost nothing in newlib's code, easy to have
both recursive and non-recursive locks.


I think it would be possible to get rid of the "class _LOCK_T lock =
&_lock_ ## lock;" part. For example with macros like:

#define __tz_lock_object &__tz_lock_storage


More information about the Newlib mailing list