This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
[PATCH] Re-enable malloc_lock for newlib-nano
- From: "Andre Vieira (lists)" <Andre dot SimoesDiasVieira at arm dot com>
- To: "newlib at sourceware dot org" <newlib at sourceware dot org>
- Date: Thu, 16 Jun 2016 12:23:51 +0100
- Subject: [PATCH] Re-enable malloc_lock for newlib-nano
- Authentication-results: sourceware.org; auth=none
Hello,
This patch re-enables the use of __malloc_lock and __malloc_unlock for
newlib-nano, re-tieing it to the newlib-multithread option. This change
makes sure a newlib-nano implementation can implement these two
functions by overwriting and otherwise they will be empty stubs.
Tested for on arm-none-eabi with both newlib and newlib-nano configurations.
Is this OK?
Cheers,
Andre
LOG:
Re-enable the use of __malloc_lock and __malloc_unlock newlib-nano, tied
the newlib-multithread.
>From ea5016d13856ff93dbffb514cd4399da82fb0967 Mon Sep 17 00:00:00 2001
From: Andre Simoes Dias Vieira <andsim01@arm.com>
Date: Thu, 16 Jun 2016 10:12:22 +0100
Subject: [PATCH] tie the use of __malloc_lock to newlib-multithread option
---
newlib/libc/stdlib/nano-mallocr.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/newlib/libc/stdlib/nano-mallocr.c b/newlib/libc/stdlib/nano-mallocr.c
index 4a2f4680ef4197adaa48b650350e18a00dacc437..0b5631cae8a6a440aa6c2f5277701e99970b94f7 100644
--- a/newlib/libc/stdlib/nano-mallocr.c
+++ b/newlib/libc/stdlib/nano-mallocr.c
@@ -58,9 +58,8 @@
#define RCALL reent_ptr,
#define RONECALL reent_ptr
-/* Disable MALLOC_LOCK so far. So it won't be thread safe */
-#define MALLOC_LOCK /*__malloc_lock(reent_ptr) */
-#define MALLOC_UNLOCK /*__malloc_unlock(reent_ptr) */
+#define MALLOC_LOCK __malloc_lock(reent_ptr)
+#define MALLOC_UNLOCK __malloc_unlock(reent_ptr)
#define RERRNO reent_ptr->_errno
--
1.9.1