[PATCH] tdb_wrap: Make mutexes easier to use

Volker Lendecke Volker.Lendecke at SerNet.DE
Tue Sep 30 05:40:32 MDT 2014


On Tue, Sep 30, 2014 at 01:21:39PM +0200, Stefan (metze) Metzmacher wrote:
> Hi Volker,
> 
> > What do you think about the attached (untested!) patch? I've
> > just came across this because I wanted to invent a new tdb
> > that is purely local and could benefit tremendously from
> > mutexes (profile.tdb, holding source3/profile/profile.c
> > data).
> > 
> > Comments appreciated!
> 
> tdb_open_ex() has
> 
>         if (tdb_flags & TDB_MUTEX_LOCKING) {
>                 tdb_flags |= TDB_INCOMPATIBLE_HASH;
>         }
> 
> so the tdb_flags |= TDB_INCOMPATIBLE_HASH; in your patch should not be
> required.

Hmm. Ok. Thanks :-)

> However there's an interaction between TDB_MUTEX_LOCKING and
> TDB_CLEAR_IF_FIRST.
> 
> Maybe we want something like this?
> 
> +		if (tdb_flags & TDB_CLEAR_IF_FIRST) {
> +			if (tdb_runtime_check_for_robust_mutexes()) {
> +				tdb_flags |= TDB_MUTEX_LOCKING;
> +			}
> +		}

That would of course also work for me. I just wanted to so
"radical" :-)

Volker

-- 
SerNet GmbH, Bahnhofsallee 1b, 37081 Göttingen
phone: +49-551-370000-0, fax: +49-551-370000-9
AG Göttingen, HRB 2816, GF: Dr. Johannes Loxen
http://www.sernet.de, mailto:kontakt at sernet.de


More information about the samba-technical mailing list