Threading libsmbclient - a proposal.

simo idra at samba.org
Wed Apr 8 00:24:48 GMT 2009


On Tue, 2009-04-07 at 16:36 -0700, Jeremy Allison wrote:
> On Tue, Apr 07, 2009 at 04:32:28PM -0700, Jeremy Allison wrote:
> > On Tue, Apr 07, 2009 at 04:15:26PM -0700, Howard Chu wrote:
> > >
> > > We often find the need for a trylock() op - fail immediately if the lock 
> > > is in use, instead of waiting.
> > 
> > I thought about that one, but I don't see an immediate need
> > for it in our code which will be mainly mutex locks around
> > globals. When *exactly* do you find a use for trylock ?
> > 
> > > Your pthread destroy_lock needs to free() the lock memory that you 
> > > malloc'd; pthread_mutex_destroy() only deinitializes it, it doesn't 
> > > actually free it.
> > 
> > Cool - thanks for the bug report. I did that in the tls code
> > bug missed it in the lock code - fixed.
> 
> Fixed versions attached. I'll add the trylock once you've
> convinced me we need it :-).

Jeremy,
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 ?

Simo.

-- 
Simo Sorce
Samba Team GPL Compliance Officer <simo at samba.org>
Principal Software Engineer at Red Hat, Inc. <simo at redhat.com>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smb_threads.h
Type: text/x-chdr
Size: 3646 bytes
Desc: not available
Url : http://lists.samba.org/archive/samba-technical/attachments/20090408/835a050e/smb_threads.bin


More information about the samba-technical mailing list