Re: CFT: snmalloc as libc malloc

From: Konstantin Belousov <kostikbel_at_gmail.com>
Date: Sun, 05 Mar 2023 17:52:17 UTC
On Sun, Mar 05, 2023 at 05:27:16PM +0000, David Chisnall wrote:
> Hi,
> 
> Thanks for the comments.  
> 
> The FlagLock is used in two places:
> 
>  - Early init, before anything in libc can be guaranteed to exist.
Before libc is initialized, there cannot be any threads except the current.
Same for libthr.

Since libthr uses internal allocator for things usually needed by mallocs,
including internal mutexes and thread keys, the only duty of third-party
malloc is to properly implement on-fork callbacks to ensure liveness after
forks.