improved thread safety?

David Collier-Brown davecb at
Sat Jan 19 16:43:33 GMT 2008

Jelmer Vernooij wrote:
> Am Freitag, den 18.01.2008, 16:40 -0800 schrieb Robert Huber:
>>Has thread safety improved much in version over 4.0alpha?
> Again, I'm a little bit confused by these version numbers. We never
> released a version
> Except for the loadparm contexts, most code in Samba 4 does not use any
> global variables and so it should be possible to call it from different
> threads, as long as you don't share contexts between threads. Is that
> the sort of thing you're looking for? 

At the expense of writing you a long answer rather than a short one,
samba 4 uses the following functions which are mt-unsafe on Solaris
and other standard-compliant systems:

I have a tool which finds these, and it found 290 lines of them.
such as:

"GIT/v4-0-test/source/lib/replace/getaddrinfo.c", line 110: gethostbyaddr
# gethostbyaddr
#      gethostbyaddr - network host database functions
#      MT-Level: MT-Unsafe

The non-comment lines are in error-message format, to make it
easy to use vim or emacs to review them all, and see if the
code around them uses locks or other techniques to make them
survive multi-threading.

Send me mail if you want data on mt-unsafe, non-posix, or
32-bit-only only code: the tool is really for porting, but
can inspect for all sorts of other things. See also  

David Collier-Brown            | Always do right. This will gratify
Sun Microsystems, Toronto      | some people and astonish the rest
davecb at                 |                      -- Mark Twain
(800) 555-9786 x56583 cell: (647) 833-9377 home off: (416) 223-5943 

More information about the samba-technical mailing list