Otto Moerbeek wrote: > > After a forkl of a threaded program __isthreaded is reset, but > existing allocations are spread around the pools. But the new single > threaded child only looks in the first pool. I have to think how to > solve this.
Create a new flag, _malloc_threads. Init to 0. Change all existing tests for __isthreaded in malloc.c to _malloc_threads. Set _malloc_threads to 1 (or N) in malloc_init(). (Future direction may be to replace _MALLOC_MUTEXES with _malloc_threads and allow it to vary somewhat based on cpu count.) Trying to reverse the process of going to thread mode is more trouble than it's work. I'd even argue there's no need to reset __isthreaded, but I don't want to get bogged down with other consequences.
