diff --git a/src/ccode/job.c b/src/ccode/job.c index 2e4cc84..c58697e 100755 --- a/src/ccode/job.c +++ b/src/ccode/job.c @@ -1,5 +1,6 @@ #include #include +#include #include #include #include @@ -13,6 +14,7 @@ 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; @@ -20,9 +22,13 @@ void* worker_thread(void* arg) { callback((void*)j->jobs[i].ctx, (void*)j->jobs[i].args); j->finished++; j->current--; + e = true; break; } } + if(!e){ + break; + } } pthread_exit(NULL); }