Threading libsmbclient - a proposal.
jra at samba.org
Wed Apr 8 00:32:48 GMT 2009
On Wed, Apr 08, 2009 at 12:24:48AM +0000, simo wrote:
> I would fine the attached header much more readable, and should be
> equivalent to your supermacro.
> The difference is that you need to define SMB_USE_THREADS in your
> program before including the header, but that shouldn't be a big deal,
> or is it ?
The problem with doing it that way is you'll have to #define that
name *before* including the header. The goal is for this to be used
by callers of libsmbclient and external libraries.
I prefer the monster macro as it allows the header file to
be included unconditionally (as an #include in libsmbclient.h)
and then turned on in the "global" definitions area (usually
just before main, or at the top of the file containing the
Otherwise you could easily get multiple function definitions
be #including the header file in different modules. The
SMB_THREADS_DEF_PTHREAD_IMPLEMENTATION() instantiates the
functions under the control of the caller, not under the
control of the header include.
More information about the samba-technical