summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorVolker Lendecke <vlendec@samba.org>2006-11-13 09:18:36 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:25:32 -0500
commit57b482c04fc0a47269d3c17fc34673a9aa1f20f4 (patch)
treeba28aceb9ef199f789f62db756407596ecf01ce2 /source4
parent9d39abf947d6d1555a72614b8f68ef670a4c2619 (diff)
downloadsamba-57b482c04fc0a47269d3c17fc34673a9aa1f20f4.tar.gz
samba-57b482c04fc0a47269d3c17fc34673a9aa1f20f4.tar.bz2
samba-57b482c04fc0a47269d3c17fc34673a9aa1f20f4.zip
r19684: Talloc_guide text on multithreading by Remi Turboult
(This used to be commit 7b9b2e5358030aed5cb69dbc93d3175c9cac4455)
Diffstat (limited to 'source4')
-rw-r--r--source4/lib/talloc/talloc_guide.txt16
1 files changed, 16 insertions, 0 deletions
diff --git a/source4/lib/talloc/talloc_guide.txt b/source4/lib/talloc/talloc_guide.txt
index 83f524862f..8b252e4ab9 100644
--- a/source4/lib/talloc/talloc_guide.txt
+++ b/source4/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);