erofs-utils: optimize pthread_cond_signal calling
PATCH 1/1 erofs-utils: optimize pthread_cond_signal calling
Call pthread_cond_signal once per file.
Signed-off-by Noboru Asai <[email protected]>
--- lib/compress.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
lib/compress.c +3 -2
@@ -1261,8 +1261,9 @@ void z_erofs_mt_workfn(struct erofs_work *work, void *tlsp) out: cwork->errcode = ret;pthread_mutex_lock (&ictx->mutex); - ++ictx->nfini; -pthread_cond_signal (&ictx->cond); +if (++ictx->nfini == ictx->seg_num) { +pthread_cond_signal (&ictx->cond); + }pthread_mutex_unlock (&ictx->mutex); }
Signature · 1 line
2.44.0