Libsmbclient & Threading
Michael B Allen
mba2000 at ioplex.com
Mon Sep 20 05:32:33 GMT 2004
On Sun, 19 Sep 2004 12:38:23 -0700 (PDT)
Richard Sharpe <rsharpe at richardsharpe.com> wrote:
> On Mon, 20 Sep 2004, Kovalyeff Sergey wrote:
> > Hello people.
> > Is it possible to use libsmbclient in multi-threaded processes?
> > I bumbed into that different processes mixing their data in parallel
> > requests... If it possible, what should I do for isolating different
> > requests from each other ?
> libsmbclient, and indeed, the underlying library that it uses, libsmb,
> were not written to be used from threaded applications.
> I think libsmbclient will have to be rewritten against Samba 4 to be
> usable from threaded applications.
I think it is important to distinguish between "thread-safe" and
"reentrant". By "thread-safe" I mean multiple threads can operate on
the same object concurrently (e.g. two threads querying the same file
descriptor at the same time) and by "reentrant" I mean multiple threads
can operate on separate objects concurrently (e.g. two threads querying
the same file but with separate file descriptors at the same time). It
is overkill for most things to be thread-safe and most things are not
thread-safe whereas virtually all libraries should be reentrant but
unfortunately there are many that are not.
Greedo shoots first? Not in my Star Wars.
More information about the samba-technical