zstdmt: fixed minor race condition

no real consequence, but pollute tsan tests :

job->dstBuff is being modified inside worker,
while main thread might read it accidentally
because it copies whole job.
But since it doesn't used dstBuff, there is no real consequence.

Other potential solution : only copy useful data, instead of whole job
This commit is contained in:
Yann Collet 2018-01-23 14:03:07 -08:00
parent ebd955e26a
commit de5e38a7a6

View File

@ -344,7 +344,9 @@ void ZSTDMT_compressChunk(void* jobDescription)
job->cSize = ERROR(memory_allocation);
goto _endJob;
}
ZSTD_PTHREAD_MUTEX_LOCK(job->jobCompleted_mutex); /* note : it's a mtctx mutex */
job->dstBuff = dstBuff;
ZSTD_pthread_mutex_unlock(job->jobCompleted_mutex);
}
/* init */