Changeset: e1a25195ce22 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/e1a25195ce22
Modified Files:
        gdk/gdk_logger.c
Branch: group-commit
Log Message:

Destroy locks when memory is freed.


diffs (49 lines):

diff --git a/gdk/gdk_logger.c b/gdk/gdk_logger.c
--- a/gdk/gdk_logger.c
+++ b/gdk/gdk_logger.c
@@ -2050,7 +2050,12 @@ logger_load(int debug, const char *fn, c
        logbat_destroy(lg->seqs_id);
        logbat_destroy(lg->seqs_val);
        logbat_destroy(lg->dseqs);
+       ATOMIC_DESTROY(&lg->refcount);
        MT_lock_destroy(&lg->lock);
+       MT_lock_destroy(&lg->rotation_lock);
+       MT_sema_destroy(&lg->flush_queue_semaphore);
+       MT_lock_destroy(&lg->flush_lock);
+       MT_lock_destroy(&lg->flush_queue_lock);
        GDKfree(lg->fn);
        GDKfree(lg->dir);
        GDKfree(lg->local_dir);
@@ -2113,14 +2118,15 @@ logger_new(int debug, const char *fn, co
        if (lg->debug & 1) {
                fprintf(stderr, "#logger_new dir set to %s\n", lg->dir);
        }
+
+       ATOMIC_INIT(&lg->refcount, 0);
        MT_lock_init(&lg->lock, fn);
-
-       // flush variables
-       ATOMIC_INIT(&lg->refcount, 0);
        MT_lock_init(&lg->rotation_lock, "rotation_lock");
        MT_sema_init(&lg->flush_queue_semaphore, FLUSH_QUEUE_SIZE, 
"flush_queue_semaphore");
        MT_lock_init(&lg->flush_lock, "flush_lock");
        MT_lock_init(&lg->flush_queue_lock, "flush_queue_lock");
+
+       // flush variables
        lg->flush_queue_begin = 0;
        lg->flush_queue_length = 0;
 
@@ -2167,8 +2173,12 @@ logger_destroy(logger *lg)
                logbat_destroy(lg->catalog_lid);
                logger_unlock(lg);
        }
+       ATOMIC_DESTROY(&lg->refcount);
        MT_lock_destroy(&lg->lock);
-       // TODO: destroy other locks
+       MT_lock_destroy(&lg->rotation_lock);
+       MT_sema_destroy(&lg->flush_queue_semaphore);
+       MT_lock_destroy(&lg->flush_lock);
+       MT_lock_destroy(&lg->flush_queue_lock);
        GDKfree(lg->fn);
        GDKfree(lg->dir);
        GDKfree(lg->buf);
_______________________________________________
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org

Reply via email to