1 #ifndef MALLOC_PROVIDED
4 <<__malloc_lock>>, <<__malloc_unlock>>---lock malloc pool
13 void __malloc_lock (struct _reent *<[reent]>);
14 void __malloc_unlock (struct _reent *<[reent]>);
17 The <<malloc>> family of routines call these functions when they need to lock
18 the memory pool. The version of these routines supplied in the library use
19 the lock API defined in sys/lock.h. If multiple threads of execution can
20 call <<malloc>>, or if <<malloc>> can be called reentrantly, then you need to
21 define your own versions of these functions in order to safely lock the
22 memory pool during a call. If you do not, the memory pool may become
25 A call to <<malloc>> may call <<__malloc_lock>> recursively; that is,
26 the sequence of calls may go <<__malloc_lock>>, <<__malloc_lock>>,
27 <<__malloc_unlock>>, <<__malloc_unlock>>. Any implementation of these
28 routines must be careful to avoid causing a thread to wait for a lock
29 that it already holds.
35 #ifndef __SINGLE_THREAD__
36 __LOCK_INIT_RECURSIVE(static, __malloc_recursive_mutex
);
43 #ifndef __SINGLE_THREAD__
44 __lock_acquire_recursive (__malloc_recursive_mutex
);
52 #ifndef __SINGLE_THREAD__
53 __lock_release_recursive (__malloc_recursive_mutex
);