Skip to content

Commit

Permalink
Fix __malloc_lock/unlock prototype change in newlib
Browse files Browse the repository at this point in the history
Signed-off-by: Frederic Pillon <[email protected]>
  • Loading branch information
fpistm committed Apr 4, 2019
1 parent 8e66896 commit 4522ca6
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions portable/MemMang/heap_useNewlib.c
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,13 @@ char * sbrk(int incr) {
//! Synonym for sbrk.
char * _sbrk(int incr) { return sbrk(incr); };

#if (__NEWLIB__ >= 3)
void __malloc_lock(struct _reent *ptr __attribute__((__unused__))) { vTaskSuspendAll(); };
void __malloc_unlock(struct _reent *ptr __attribute__((__unused__))) { (void)xTaskResumeAll(); };
#else
void __malloc_lock() { vTaskSuspendAll(); };
void __malloc_unlock() { (void)xTaskResumeAll(); };
#endif

// newlib also requires implementing locks for the application's environment memory space,
// accessed by newlib's setenv() and getenv() functions.
Expand Down

0 comments on commit 4522ca6

Please sign in to comment.