Skip to contentSkip to conversation

erofs-utils: optimize pthread_cond_signal calling

PATCH In review Noboru Asai 2 participants 2 messages May 1, 2024 Library code

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 erofs-utils: optimize pthread_cond_signal calling

Call pthread_cond_signal once per file.

---
 lib/compress.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
lib/compress.c +2 -2
index 7fef698..5c25ca8 100644
@@ -1261,8 +1261,8 @@ 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