Threading libsmbclient - a proposal.
simo
idra at samba.org
Wed Apr 8 00:41:23 GMT 2009
On Tue, 2009-04-07 at 17:32 -0700, Jeremy Allison wrote:
> 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.
That's what I said :-)
#define SMB_USE_THREADS
#include <libsmbclient.h>
> The goal is for this to be used
> by callers of libsmbclient and external libraries.
yup.
> 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
> entry point).
I honestly don't see the difference.
> Otherwise you could easily get multiple function definitions
> be #including the header file in different modules.
No, you have barriers in the include:
#ifndef _smb_threads_h_
#define _smb_threads_h_
So multiple inclusion shouldn't really happen.
> The
> SMB_THREADS_DEF_PTHREAD_IMPLEMENTATION() instantiates the
> functions under the control of the caller, not under the
> control of the header include.
I am trying to understand in which case this would make a difference.
Simo.
--
Simo Sorce
Samba Team GPL Compliance Officer <simo at samba.org>
Principal Software Engineer at Red Hat, Inc. <simo at redhat.com>
More information about the samba-technical
mailing list