Changeset: 0a51d20c8e85 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/0a51d20c8e85
Modified Files:
        gdk/gdk_select.c
Branch: Jan2022
Log Message:

Unlock hash on timeout, small cleanup


diffs (50 lines):

diff --git a/gdk/gdk_select.c b/gdk/gdk_select.c
--- a/gdk/gdk_select.c
+++ b/gdk/gdk_select.c
@@ -143,9 +143,7 @@ hashselect(BAT *b, BATiter *bi, struct c
                MT_rwlock_rdlock(&b->thashlock);
                if (b->thash == NULL) {
                        GDKerror("Hash destroyed before we could use it\n");
-                       BBPreclaim(bn);
-                       MT_rwlock_rdunlock(&b->thashlock);
-                       return NULL;
+                       goto bailout;
                }
        }
        switch (ATOMbasetype(b->ttype)) {
@@ -168,11 +166,8 @@ hashselect(BAT *b, BATiter *bi, struct c
                                dst = buninsfix(bn, dst, cnt, o,
                                                maximum - BATcapacity(bn),
                                                maximum);
-                               if (dst == NULL) {
-                                       MT_rwlock_rdunlock(&b->thashlock);
-                                       BBPreclaim(bn);
-                                       return NULL;
-                               }
+                               if (dst == NULL)
+                                       goto bailout;
                                cnt++;
                        }
                }
@@ -184,11 +179,8 @@ hashselect(BAT *b, BATiter *bi, struct c
                        dst = buninsfix(bn, dst, cnt, o,
                                        maximum - BATcapacity(bn),
                                        maximum);
-                       if (dst == NULL) {
-                               MT_rwlock_rdunlock(&b->thashlock);
-                               BBPreclaim(bn);
-                               return NULL;
-                       }
+                       if (dst == NULL)
+                               goto bailout;
                        cnt++;
                }
        }
@@ -210,6 +202,7 @@ hashselect(BAT *b, BATiter *bi, struct c
        return bn;
 
   bailout:
+       MT_rwlock_rdunlock(&b->thashlock);
        BBPreclaim(bn);
        return NULL;
 }
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to