From de5e38a7a60ef80f4e71838df87cea15c5e15047 Mon Sep 17 00:00:00 2001 From: Yann Collet Date: Tue, 23 Jan 2018 14:03:07 -0800 Subject: [PATCH] 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 --- lib/compress/zstdmt_compress.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/compress/zstdmt_compress.c b/lib/compress/zstdmt_compress.c index be683e83f..922839810 100644 --- a/lib/compress/zstdmt_compress.c +++ b/lib/compress/zstdmt_compress.c @@ -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 */ -- 2.47.2