projects
/
ccan
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
83a1386
)
Handle global_lock properly in tdb_transaction_lock/unlock.
author
Rusty Russell
<rusty@rustcorp.com.au>
Thu, 16 Jul 2009 08:37:14 +0000
(18:07 +0930)
committer
Rusty Russell
<rusty@rustcorp.com.au>
Thu, 16 Jul 2009 08:37:14 +0000
(18:07 +0930)
ccan/tdb/lock.c
patch
|
blob
|
history
diff --git
a/ccan/tdb/lock.c
b/ccan/tdb/lock.c
index 117596a3f203814daa9e4611d96b1216de050643..bcd560d792231ff2defce3430cf6feb7117fa243 100644
(file)
--- a/
ccan/tdb/lock.c
+++ b/
ccan/tdb/lock.c
@@
-301,7
+301,10
@@
int tdb_unlock(struct tdb_context *tdb, int list, int ltype)
*/
int tdb_transaction_lock(struct tdb_context *tdb, int ltype)
{
- if (tdb->have_transaction_lock || tdb->global_lock.count) {
+ if (tdb->global_lock.count) {
+ return 0;
+ }
+ if (tdb->have_transaction_lock) {
tdb->have_transaction_lock++;
return 0;
}
@@
-320,6
+323,9
@@
int tdb_transaction_lock(struct tdb_context *tdb, int ltype)
*/
int tdb_transaction_unlock(struct tdb_context *tdb)
{
+ if (tdb->global_lock.count) {
+ return 0;
+ }
if (--tdb->have_transaction_lock) {
return 0;
}