libsmbclient threadsafeness
David Wuertele
dave-gnus at bfnet.com
Mon Oct 18 23:09:03 GMT 2004
Hi Michael, thanks for the advice.
Michael> I don't think anyone is going to be brave enough to tell you
Michael> which functions are or are not thread safe.
Yeah, I don't expect people to go out on a limb and say "That one's
guaranteed to be threadsafe", but on the other hand I thought it was
worth asking which ones are known to be *not* OK. It is a lot easier
to know something is broken than to know it is not broken.
Michael> BOOL
Michael> ts_cli_nt_session_open(struct cli_state *cli, const int pipe_idx,
Michael> pthread_mutex_t *lock)
Michael> {
Michael> BOOL ret;
Michael> pthread_mutex_lock(lock);
Michael> ret = cli_nt_session_open(cli, pipe_idx);
Michael> pthread_mutex_unlock(lock);
Michael> return ret;
Michael> }
This is essentially what I've done, but inline without defining a
function. Since I've done it for every call into libsmbclient
already, I'm now going to try backing off things that probably don't
need it, like "pull_ascii_fstring()" and the like.
Michael> So when you say "massively threaded" I hope you realize that
Michael> using more threads isn't necessarily going to increase
Michael> paralellism.
Yes I understand that. Fortunately (for the performance of my
program) there are lots of things that keep the threads busy when they
aren't calling libsmbclient functions. But I still want any gain that
I can get by backing out any of my locks.
Dave
More information about the samba-technical
mailing list