diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2006-09-06 23:13:23 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2006-09-06 23:13:23 +0400 |
commit | e7d6537f1c5227005ccddc52987ea720ba66bc80 (patch) | |
tree | 5ac48fd44121194b879fc002d369281494a7598d /intern/guardedalloc/MEM_guardedalloc.h | |
parent | d444f25b2864b7d4a9ae39211c695e36ffd813a8 (diff) |
Added support for threadsafe MEM_mallocN/MEM_freeN in the guardedalloc
module itself, replacing the special MEM_mallocT/MEM_freeT functions.
Mutex locking is only enabled when threads are running.
There was no good reason to have these separate, it just led to ugly
hacks when calling functions with non-threadsafe malloc from threads.
Diffstat (limited to 'intern/guardedalloc/MEM_guardedalloc.h')
-rw-r--r-- | intern/guardedalloc/MEM_guardedalloc.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/intern/guardedalloc/MEM_guardedalloc.h b/intern/guardedalloc/MEM_guardedalloc.h index c9338d0ae8a..ce9f2a273bd 100644 --- a/intern/guardedalloc/MEM_guardedalloc.h +++ b/intern/guardedalloc/MEM_guardedalloc.h @@ -112,6 +112,10 @@ extern "C" { * @retval 0 for correct memory, 1 for corrupted memory. */ int MEM_check_memory_integrity(void); + /** Set thread locking functions for safe memory allocation from multiple + threads, pass NULL pointers to disable thread locking again. */ + void MEM_set_lock_callback(void (*lock)(void), void (*unlock)(void)); + #ifdef __cplusplus } #endif |