Changeset: b805df69715f for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=b805df69715f
Modified Files:
gdk/gdk_batop.c
monetdb5/mal/mal_dataflow.c
Branch: default
Log Message:
Merge with Feb2013 branch.
diffs (95 lines):
diff --git a/gdk/gdk_batop.c b/gdk/gdk_batop.c
--- a/gdk/gdk_batop.c
+++ b/gdk/gdk_batop.c
@@ -2247,8 +2247,8 @@ BATmergecand(BAT *a, BAT *b)
BATcheck(b, "BATmergecand");
assert(a->htype == TYPE_void);
assert(b->htype == TYPE_void);
- assert(ATOMtype(a->htype) == TYPE_oid);
- assert(ATOMtype(b->htype) == TYPE_oid);
+ assert(ATOMtype(a->ttype) == TYPE_oid);
+ assert(ATOMtype(b->ttype) == TYPE_oid);
assert(BATcount(a) <= 1 || a->tsorted);
assert(BATcount(b) <= 1 || b->tsorted);
assert(BATcount(a) <= 1 || a->tkey);
@@ -2350,8 +2350,8 @@ BATintersectcand(BAT *a, BAT *b)
BATcheck(b, "BATintersectcand");
assert(a->htype == TYPE_void);
assert(b->htype == TYPE_void);
- assert(ATOMtype(a->htype) == TYPE_oid);
- assert(ATOMtype(b->htype) == TYPE_oid);
+ assert(ATOMtype(a->ttype) == TYPE_oid);
+ assert(ATOMtype(b->ttype) == TYPE_oid);
assert(a->tsorted);
assert(b->tsorted);
assert(a->tkey);
diff --git a/monetdb5/mal/mal_dataflow.c b/monetdb5/mal/mal_dataflow.c
--- a/monetdb5/mal/mal_dataflow.c
+++ b/monetdb5/mal/mal_dataflow.c
@@ -61,10 +61,10 @@ typedef struct queue {
int size; /* size of queue */
int last; /* last element in the queue */
int exitcount; /* how many threads should exit */
+ int exitedcount; /* how many threads have exited
*/
FlowEvent *data;
MT_Lock l; /* it's a shared resource, ie we need locks */
MT_Sema s; /* threads wait on empty queues */
- MT_Sema e; /* synchronize exiting of thread */
} Queue;
/*
@@ -127,11 +127,11 @@ q_create(int sz, const char *name)
return NULL;
}
q->exitcount = 0;
+ q->exitedcount = 0;
(void) name; /* in case MT_LOCK_TRACE is not enabled in gdk_system.h */
MT_lock_init(&q->l, name);
MT_sema_init(&q->s, 0, name);
- MT_sema_init(&q->e, 0, name);
return q;
}
@@ -220,7 +220,9 @@ q_dequeue(Queue *q)
if (q->exitcount > 0) {
q->exitcount--;
MT_lock_unset(&q->l, "q_dequeue");
- MT_sema_up(&q->e, "q_dequeue");
+ MT_lock_set(&mal_contextLock, "q_dequeue");
+ q->exitedcount++;
+ MT_lock_unset(&mal_contextLock, "q_dequeue");
return NULL;
}
assert(q->last > 0);
@@ -678,6 +680,13 @@ runMALdataflow(Client cntxt, MalBlkPtr m
/* create one more worker to compensate for our waiting until
* all work is done */
MT_lock_set(&mal_contextLock, "runMALdataflow");
+ for (i = 0; i < THREADS && todo->exitedcount > 0; i++) {
+ if (workers[i].flag == EXITED) {
+ todo->exitedcount--;
+ workers[i].flag = IDLE;
+ MT_join_thread(workers[i].id);
+ }
+ }
for (i = 0; i < THREADS; i++) {
if (workers[i].flag == IDLE) {
if (MT_create_thread(&workers[i].id,
DFLOWworker, (void *) &workers[i], MT_THR_JOINABLE) < 0) {
@@ -764,16 +773,6 @@ runMALdataflow(Client cntxt, MalBlkPtr m
todo->exitcount++;
MT_lock_unset(&todo->l, "runMALdataflow");
MT_sema_up(&todo->s, "runMALdataflow");
- MT_sema_down(&todo->e, "runMALdataflow");
- MT_lock_set(&mal_contextLock, "runMALdataflow");
- for (i = 0; i < THREADS; i++) {
- if (workers[i].flag == EXITED) {
- MT_join_thread(workers[i].id);
- workers[i].flag = IDLE;
- break;
- }
- }
- MT_lock_unset(&mal_contextLock, "runMALdataflow");
}
return msg;
}
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list