From 37f56873d5f521d4fc1bc2ef6ea718a91e3570a6 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Fri, 9 Mar 2007 12:42:35 +0100 Subject: [PATCH] Remove ->mutex after last use, not on job exit Frees up that file descriptor. Signed-off-by: Jens Axboe --- fio.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/fio.c b/fio.c index 3cf2a9b1..6ce46ba5 100644 --- a/fio.c +++ b/fio.c @@ -734,6 +734,12 @@ static void *thread_main(void *data) fio_sem_up(startup_sem); fio_sem_down(td->mutex); + /* + * the ->mutex semaphore is now no longer used, close it to avoid + * eating a file descriptor + */ + fio_sem_remove(td->mutex); + if (!td->create_serialize && setup_files(td)) goto err; @@ -930,8 +936,6 @@ reaped: perror("pthread_join"); } - fio_sem_remove(td->mutex); - (*nr_running)--; (*m_rate) -= td->ratemin; (*t_rate) -= td->rate; -- 2.25.1