Skip to content

Commit

Permalink
fix parallel remove
Browse files Browse the repository at this point in the history
  • Loading branch information
sulincix committed May 20, 2024
1 parent 43885fb commit cb793e9
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/ccode/job.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <pthread.h>
#include <string.h>
#include <stdarg.h>
Expand All @@ -13,16 +14,21 @@ void* worker_thread(void* arg) {
break;
}
int i;
bool e = false; /* search for job */
for (i = 0; i < j->total; ++i) {
if (j->jobs[i].callback != NULL) {
void (*callback)(void*, ...) = j->jobs[i].callback;
j->jobs[i].callback = NULL;
callback((void*)j->jobs[i].ctx, (void*)j->jobs[i].args);
j->finished++;
j->current--;
e = true;
break;
}
}
if(!e){
break;
}
}
pthread_exit(NULL);
}
Expand Down

0 comments on commit cb793e9

Please sign in to comment.