Changeset: 737eb67c82c4 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/737eb67c82c4
Modified Files:
        gdk/gdk_align.c
        gdk/gdk_batop.c
        gdk/gdk_private.h
Branch: Sep2022
Log Message:

Fix a data race.


diffs (63 lines):

diff --git a/gdk/gdk_align.c b/gdk/gdk_align.c
--- a/gdk/gdk_align.c
+++ b/gdk/gdk_align.c
@@ -280,16 +280,16 @@ BATmaterialize(BAT *b, BUN cap)
  * the underlying BAT and compensates for outliers.
  */
 void
-VIEWbounds(BAT *b, BAT *view, BUN l, BUN h)
+VIEWboundsbi(BATiter *bi, BAT *view, BUN l, BUN h)
 {
        BUN cnt;
        BUN baseoff;
 
-       if (b == NULL || view == NULL)
+       if (bi == NULL || view == NULL)
                return;
-       if (h > BATcount(b))
-               h = BATcount(b);
-       baseoff = b->tbaseoff;
+       if (h > bi->count)
+               h = bi->count;
+       baseoff = bi->baseoff;
        if (h < l)
                h = l;
        cnt = h - l;
@@ -325,6 +325,13 @@ VIEWbounds(BAT *b, BAT *view, BUN l, BUN
                view->tmaxpos = BUN_NONE;
        view->tkey |= cnt <= 1;
 }
+void
+VIEWbounds(BAT *b, BAT *view, BUN l, BUN h)
+{
+       BATiter bi = bat_iterator(b);
+       VIEWboundsbi(&bi, view, l, h);
+       bat_iterator_end(&bi);
+}
 
 /*
  * Destroy a view.
diff --git a/gdk/gdk_batop.c b/gdk/gdk_batop.c
--- a/gdk/gdk_batop.c
+++ b/gdk/gdk_batop.c
@@ -1818,7 +1818,7 @@ BATslice(BAT *b, BUN l, BUN h)
                bn = VIEWcreate(b->hseqbase + low, b);
                if (bn == NULL)
                        goto doreturn;
-               VIEWbounds(b, bn, l, h);
+               VIEWboundsbi(&bi, bn, l, h);
        } else {
                /* create a new BAT and put everything into it */
                BUN p = l;
diff --git a/gdk/gdk_private.h b/gdk/gdk_private.h
--- a/gdk/gdk_private.h
+++ b/gdk/gdk_private.h
@@ -276,6 +276,8 @@ gdk_return strWrite(const char *a, strea
 gdk_return unshare_varsized_heap(BAT *b)
        __attribute__((__warn_unused_result__))
        __attribute__((__visibility__("hidden")));
+void VIEWboundsbi(BATiter *bi, BAT *view, BUN l, BUN h)
+       __attribute__((__visibility__("hidden")));
 void VIEWdestroy(BAT *b)
        __attribute__((__visibility__("hidden")));
 BAT *virtualize(BAT *bn)
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to