projects
/
fio.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
d4ac64c
)
Fix bug in fio mutex initialization
author
Zhang, Yanmin
<yanmin_zhang@linux.intel.com>
Mon, 4 Feb 2008 08:17:52 +0000
(09:17 +0100)
committer
Jens Axboe
<jens.axboe@oracle.com>
Mon, 4 Feb 2008 08:17:52 +0000
(09:17 +0100)
Fio sem->cond isn't initialized properly.
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
mutex.c
patch
|
blob
|
blame
|
history
diff --git
a/mutex.c
b/mutex.c
index be3258df8347937a47bf68a99402283d2381b51a..17e62c9f5152c0ab29966915b8874a4a1592ce45 100644
(file)
--- a/
mutex.c
+++ b/
mutex.c
@@
-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;