fixed some issues with segfaults

dev
Paul Cruz 2017-07-03 19:28:48 -07:00
parent 95ea54b4cf
commit cd50382c03
2 changed files with 10 additions and 1 deletions

Binary file not shown.

View File

@ -64,6 +64,15 @@ static adaptCCtx* createCCtx(unsigned numJobs, const char* const outFilename)
pthread_cond_init(&ctx->allJobsCompleted_cond, NULL);
ctx->numJobs = numJobs;
ctx->jobs = calloc(1, numJobs*sizeof(jobDescription));
{
unsigned u;
for (u=0; u<numJobs; u++) {
ctx->jobs[u].jobCompleted_mutex = &ctx->jobCompleted_mutex;
ctx->jobs[u].jobCompleted_cond = &ctx->jobCompleted_cond;
ctx->jobs[u].jobReady_mutex = &ctx->jobReady_mutex;
ctx->jobs[u].jobReady_cond = &ctx->jobReady_cond;
}
}
ctx->nextJobID = 0;
ctx->threadError = 0;
ctx->allJobsCompleted = 0;