talloc null context thread safe ?
Rémi
turboult at easynet.fr
Mon Nov 6 22:19:05 GMT 2006
Hello,
I am using talloc in a project other than Samba : I hope this is the right
list for my question.
I understand that talloc does not deal with threads, and in fact, it is thread
safe, as long as each thread uses different memory contexts. If two threads
uses the same context then they need to synchronise in order to be safe.
Am I correct ?
If so, my concern is with the allocation of "top-level" contexts i.e. when
using a NULL parent. When using the "talloc_enable_leak_report", I understand
that the NULL context is in fact a hidden "null context" global variable, so
allocating anything from the NULL context (e.g. tmp_ctx = talloc_new (NULL))
is no longer thread safe. Am I missing something, or may be this is obvious ?
So in multi-thread environement, I should never use a NULL context as a parent
(may be instead define my own per-thread null-context).
Regards,
Rémi
More information about the samba-technical
mailing list