Patch: General locking (was Possible deadlock and solution)

Matthias Andree matthias.andree at gmx.de
Tue Oct 1 19:49:21 CEST 2002


On Tue, 01 Oct 2002, Gyepi SAM wrote:

> On Tue, Oct 01, 2002 at 03:25:17PM +0200, Matthias Andree wrote:
> > On Mon, 30 Sep 2002, Gyepi SAM wrote:
> > 
> 
> > Is this SETLKW/SETLK complexity necessary? Why not F_SETLK all over the
> > place?
> 
> Because the first database in the list must be locked in blocking mode.
> In any case, I have simplified this a bit.

After thinking about this, it looks right.

> --- datastore_db.c	24 Sep 2002 19:45:45 -0000	1.2
> +++ datastore_db.c	1 Oct 2002 17:25:15 -0000
> +void db_lock_release_list(void *vhandle_list[], int n){
> +  for (; n > 0; n--){
> +    db_lock_release(vhandle_list[n - 1]);
> +  }
> +}

*nitpick*

while(--n >= 0) {
  db_lock_release(vhandle_list[n]);
}

saves the subtraction. Not that it matters unless you lock dozens of
those.

> +static void lock_msg(dbh_t *handle, int index, char *msg, int cmd, int type)

Fine.

-- 
Matthias Andree



More information about the bogofilter-dev mailing list