Changeset: 6c917fe95c2b for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/6c917fe95c2b
Modified Files:
gdk/gdk_bbp.c
Branch: Jan2022
Log Message:
Keep lock the whole time we're looking at the bat descriptor.
diffs (47 lines):
diff --git a/gdk/gdk_bbp.c b/gdk/gdk_bbp.c
--- a/gdk/gdk_bbp.c
+++ b/gdk/gdk_bbp.c
@@ -2967,6 +2967,7 @@ decref(bat i, bool logical, bool release
{
int refs = 0, lrefs;
bool swap = false;
+ bool locked = false;
bat tp = 0, tvp = 0;
int farmid = 0;
BAT *b;
@@ -3021,6 +3022,8 @@ decref(bat i, bool logical, bool release
assert(b == NULL || b->tvheap == NULL ||
BBP_refs(b->tvheap->parentid) > 0);
refs = --BBP_refs(i);
if (b && refs == 0) {
+ MT_lock_set(&b->theaplock);
+ locked = true;
tp = VIEWtparent(b);
tvp = VIEWvtparent(b);
if (tp || tvp)
@@ -3029,7 +3032,8 @@ decref(bat i, bool logical, bool release
}
}
if (b) {
- MT_lock_set(&b->theaplock);
+ if (!locked)
+ MT_lock_set(&b->theaplock);
if (b->batCount > b->batInserted && !isVIEW(b)) {
/* if batCount is larger than batInserted and
* the dirty bits are off, it may be that a
@@ -3043,7 +3047,6 @@ decref(bat i, bool logical, bool release
}
if (b->theap)
farmid = b->theap->farmid;
- MT_lock_unset(&b->theaplock);
}
/* we destroy transients asap and unload persistent bats only
@@ -3077,6 +3080,8 @@ decref(bat i, bool logical, bool release
swap = true;
} /* else: bat cannot be swapped out */
lrefs = BBP_lrefs(i);
+ if (b)
+ MT_lock_unset(&b->theaplock);
/* unlock before re-locking in unload; as saving a dirty
* persistent bat may take a long time */
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]