Suggestion for mt_alloc.

Dhruv Matani dhruvbird@gmx.net
Sun Feb 8 05:08:00 GMT 2004


Why not keep mt_alloc a proper multi_thread allocator ONLY. No ST
support, and when __GTHREADS is not defined, use the default pool
allocator without thread support.

Also, one more thing that comes to my mind is that is it possible to
provide a Mt_Layer abstraction similar to debug_allocator? So, any
allocator can be made simple mt compatible by doing:

Mt_Layer<Some_Allocator<Type>, Mutex_Type>?


That way, the Locking can be removed from the pool_allocator, and
shifted to this layer, so that even if a user provides an ST allocator,
and wants basic Mutex locking on allocation/deallocation, it can be done
with one line of code?



-- 
	-Dhruv Matani.
http://www.geocities.com/dhruvbird/





More information about the Libstdc++ mailing list