summaryrefslogtreecommitdiff
path: root/source3/lib
diff options
context:
space:
mode:
authorVolker Lendecke <vlendec@samba.org>2006-11-11 17:02:08 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:15:45 -0500
commitdd8f8c01b7ba425da7db008c33a3cff9325b65d8 (patch)
tree9b4d9deed7302c630e9e28c03344bfb73eca2321 /source3/lib
parentb6fda7f8bd48e836e7ded2a610b69ff760f9d989 (diff)
downloadsamba-dd8f8c01b7ba425da7db008c33a3cff9325b65d8.tar.gz
samba-dd8f8c01b7ba425da7db008c33a3cff9325b65d8.tar.bz2
samba-dd8f8c01b7ba425da7db008c33a3cff9325b65d8.zip
r19666: Talloc_guide text on multithreading by Remi Turboult
(This used to be commit 36a7bf738afd466e378fb2f09d1ce0b47ec924a4)
Diffstat (limited to 'source3/lib')
-rw-r--r--source3/lib/talloc/talloc_guide.txt16
1 files changed, 16 insertions, 0 deletions
diff --git a/source3/lib/talloc/talloc_guide.txt b/source3/lib/talloc/talloc_guide.txt
index 83f524862f..8b252e4ab9 100644
--- a/source3/lib/talloc/talloc_guide.txt
+++ b/source3/lib/talloc/talloc_guide.txt
@@ -56,6 +56,22 @@ talloc API
The following is a complete guide to the talloc API. Read it all at
least twice.
+Multi-threading
+---------------
+
+talloc itself does not deal with threads. It is thread-safe (assuming
+the underlying "malloc" is), as long as each thread uses different
+memory contexts.
+If two threads uses the same context then they need to synchronize in
+order to be safe. In particular:
+- when using talloc_enable_leak_report(), giving directly NULL as a
+parent context implicitly refers to a hidden "null context" global
+variable, so this should not be used in a multi-threaded environment
+without proper synchronization ;
+- the context returned by talloc_autofree_context() is also global so
+shouldn't be used by several threads simultaneously without
+synchronization.
+
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
(type *)talloc(const void *context, type);