projects
/
ccan
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
a879e3e
)
tdb: use tdb_nest_lock() for seqnum lock.
author
Rusty Russell
<rusty@rustcorp.com.au>
Mon, 22 Feb 2010 03:48:32 +0000
(14:18 +1030)
committer
Rusty Russell
<rusty@rustcorp.com.au>
Mon, 22 Feb 2010 03:48:32 +0000
(14:18 +1030)
This is pure overhead, but it centralizes the locking. Realloc (esp. as
most implementations are lazy) is fast compared to the fnctl anyway.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
ccan/tdb/tdb.c
patch
|
blob
|
history
diff --git
a/ccan/tdb/tdb.c
b/ccan/tdb/tdb.c
index 2da4428230971f8602e9536d7a7af2abf69e404a..ede0027564099aa44bf501ce1097f030d66dd0c2 100644
(file)
--- a/
ccan/tdb/tdb.c
+++ b/
ccan/tdb/tdb.c
@@
-59,14
+59,14
@@
static void tdb_increment_seqnum(struct tdb_context *tdb)
return;
}
- if (tdb_
brlock(tdb, F_WRLCK, TDB_SEQNUM_OFS, 1
,
- TDB_LOCK_WAIT|TDB_LOCK_PROBE) != 0) {
+ if (tdb_
nest_lock(tdb, TDB_SEQNUM_OFS, F_WRLCK
,
+
TDB_LOCK_WAIT|TDB_LOCK_PROBE) != 0) {
return;
}
tdb_increment_seqnum_nonblock(tdb);
- tdb_
brunlock(tdb, F_WRLCK, TDB_SEQNUM_OFS, 1
);
+ tdb_
nest_unlock(tdb, TDB_SEQNUM_OFS, F_WRLCK, false
);
}
static int tdb_key_compare(TDB_DATA key, TDB_DATA data, void *private_data)