Remove talloc from libwbclient

Volker Lendecke Volker.Lendecke at SerNet.DE
Sun Feb 7 04:48:46 MST 2010


On Sat, Feb 06, 2010 at 07:40:47PM -0500, simo wrote:
> > The problem is that you can't use talloc in a thread-safe
> > way from within a library where you don't control access to
> > the NULL context at all.
> > 
> > A different way to do this would be to have a thread-safe
> > version of talloc_init() that we could use as a shared
> > talloc parent in libwbclient, where we could control and
> > mutex the access to it.
> 
> Yes this could very possibly be useful not just for libwbclient, but for
> any user that wants to use talloc and also needs to use threads.
> I think it's really worth considering.

Just brainstorming here without much experience in
thread-programming, so excuse me if I'm talking rubbish:

Looking at the existing users of talloc_init() and
talloc_xx(NULL) I would say that almost all should replaced
by something like talloc_tos() (which itself needs to use
thread-local storage eventually) or talloc_new(), they are
just temporary contexts. The valid uses of a NULL context
are rare enough that it might be possible to mutex that
properly without noticable performance impact.

Libwbclient could then go and continue using talloc as it
does right now.

Any flaws in this approach?

Volker
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: Digital signature
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20100207/6eb3fda2/attachment.pgp>


More information about the samba-technical mailing list