Changeset: d4aee57f0795 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=d4aee57f0795
Modified Files:
        monetdb5/modules/mal/tablet.c
Branch: Jan2014
Log Message:

Fix race condition.
Check ateof field after the sema down since it gets set by the thread
doing the up.


diffs (25 lines):

diff --git a/monetdb5/modules/mal/tablet.c b/monetdb5/modules/mal/tablet.c
--- a/monetdb5/modules/mal/tablet.c
+++ b/monetdb5/modules/mal/tablet.c
@@ -1450,16 +1450,15 @@ SQLload_file(Client cntxt, Tablet *as, b
                        for (j = 0; j < threads; j++)
                                MT_sema_down(&ptask[j].reply, "SQLload_file");
                }
-#ifndef SQLLOADTHREAD
-               if ((e == NULL || s >= end || e >= end) && cnt < (BUN) maxrow)
+               if ((e == NULL || s >= end || e >= end) && cnt < (BUN) maxrow) {
+#ifdef SQLLOADTHREAD
+                       MT_sema_down(&task->consumer, "SQLload_file");
+#else
                        task->ateof = tablet_read_more(task->b, task->out, 
task->b->size - (task->b->len - task->b->pos)) == EOF;
 #endif
+               }
                if (task->ateof)
                        break;
-#ifdef SQLLOADTHREAD
-               if ((e == NULL || s >= end || e >= end) && cnt < (BUN) maxrow)
-                       MT_sema_down(&task->consumer, "SQLload_file");
-#endif
        }
 
        if (task->b->pos < task->b->len && cnt < (BUN) maxrow && task->ateof) {
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to