[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-libc-dev] making malloc() and free() reentrant safe
From: |
Joerg Wunsch |
Subject: |
Re: [avr-libc-dev] making malloc() and free() reentrant safe |
Date: |
Tue, 28 Jun 2005 22:52:05 +0200 |
User-agent: |
Mutt/1.4.2.1i |
As Branislav Katreniak wrote:
> I want to use a multitasking OS in my project. What is the best way
> to encapsulate all calls to malloc() and free() with a
> synchronization primitives? I want all calls to these functions
> (even from other libc functions) to be reentrant safe and ideally
> I'd like to use official libc library without any modifications.
First, if you don't use stdio (or only use sprintf without
floating-point), the library doesn't use malloc() itself, so it would
suffice to wrap malloc() and free() in your own macros.
If you need stdio functions that call malloc, hmm, I think that'll put
something else onto your list of non-reentrant functions ;-), but
still, you could just import the implementations for malloc/free into
your own application, and make them thread-safe.
--
cheers, J"org .-.-. --... ...-- -.. . DL8DTL
http://www.sax.de/~joerg/ NIC: JW11-RIPE
Never trust an operating system you don't have sources for. ;-)