problem about talloc with multi-threads

ssdl.566 ssdl.566 at
Fri Aug 3 04:06:00 UTC 2018

Hi all:
        i want to know how to use talloc with multi-threads.
        we need to access the same memory context , in multi threads, for example : we need to call talloc_new in one thread and call talloc_free in another thread.
 as far as i know, talloc cannot deal with multi-threads, so i add a global pthread spin_lock  in talloc.c ,  lock the global lock in talloc_new , talloc_free and other talloc functions.
        when i run the test, sometimes the program panic. and i got the error:  Bad talloc magic value  - unknow value

         i want to ask what is the right way to use talloc in multi-threads.

peace and happiness.

More information about the samba-technical mailing list