diff options
author | Zhang, Yanmin <yanmin_zhang@linux.intel.com> | 2008-02-04 09:17:52 +0100 |
---|---|---|
committer | Jens Axboe <jens.axboe@oracle.com> | 2008-02-04 09:17:52 +0100 |
commit | 108fcc1142ad5d087978190dbd7dd782e9b17d1d (patch) | |
tree | 7466d2f5964c3bc3a3786c74b75ac1b7894955f4 /mutex.c | |
parent | d4ac64cc1e8bb64b71a1f8ae882ee171d02fe792 (diff) | |
download | fio-108fcc1142ad5d087978190dbd7dd782e9b17d1d.tar.gz |
Fix bug in fio mutex initialization
Fio sem->cond isn't initialized properly.
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'mutex.c')
-rw-r--r-- | mutex.c | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -19,6 +19,7 @@ struct fio_sem *fio_sem_init(int value) char sem_name[] = "/tmp/.fio_sem.XXXXXX"; struct fio_sem *sem = NULL; pthread_mutexattr_t attr; + pthread_condattr_t cond; int fd; fd = mkstemp(sem_name); @@ -53,6 +54,11 @@ struct fio_sem *fio_sem_init(int value) perror("pthread_mutexattr_setpshared"); goto err; } + + pthread_condattr_init(&cond); + pthread_condattr_setpshared(&cond, PTHREAD_PROCESS_SHARED); + pthread_cond_init(&sem->cond, &cond); + if (pthread_mutex_init(&sem->lock, &attr)) { perror("pthread_mutex_init"); goto err; |