Changeset: 8d4eb423cad0 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/8d4eb423cad0
Modified Files:
        monetdb5/mal/mal_pipelines.c
Branch: default
Log Message:

add some locks around adding tasks to the pipeline queues


diffs (33 lines):

diff --git a/monetdb5/mal/mal_pipelines.c b/monetdb5/mal/mal_pipelines.c
--- a/monetdb5/mal/mal_pipelines.c
+++ b/monetdb5/mal/mal_pipelines.c
@@ -287,6 +287,7 @@ runMALpipelines(Client cntxt, MalBlkPtr 
        Pipelines *s = GDKmalloc(sizeof(Pipelines));
        if (!s)
                throw(MAL, "pipelines", SQLSTATE(HY013) MAL_MALLOC_FAIL);
+       MT_lock_set(&pipelineLock);
        bool profiler = cntxt->sqlprofiler;
        *s = (Pipelines) {
                .mb = mb,
@@ -320,11 +321,13 @@ runMALpipelines(Client cntxt, MalBlkPtr 
        for (int i = 0; i < s->nr_workers; i++)
                q_enqueue(workers[i].q, s);
 
+       MT_lock_unset(&pipelineLock);
        /* wait for result */
        for (int i = 0; i < s->nr_workers; i++)
                MT_sema_down(&s->s);
        MT_sema_destroy(&s->s);
        MT_lock_destroy(&s->l);
+       MT_lock_set(&pipelineLock);
        bool has_sink = (s->sink != 0);
        str err = s->error;
        if (err) {
@@ -357,6 +360,7 @@ runMALpipelines(Client cntxt, MalBlkPtr 
        }
        GDKfree(s);
        cntxt->sqlprofiler = profiler;
+       MT_lock_unset(&pipelineLock);
        if (restart) /* TODO move into new loop around pipeline */
                return runMALpipelines(cntxt, mb, startpc, stoppc, maxparts, 
sink, stk);
        return has_sink ? NULL : err;
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to