Lines Matching refs:lock

65 	ret = pthread_mutex_init(&mutex->lock, &attr);  in __fio_mutex_init()
112 pthread_mutex_lock(&mutex->lock); in fio_mutex_down_timeout()
121 ret = pthread_cond_timedwait(&mutex->cond, &mutex->lock, &t); in fio_mutex_down_timeout()
130 pthread_mutex_unlock(&mutex->lock); in fio_mutex_down_timeout()
142 pthread_mutex_lock(&mutex->lock); in fio_mutex_down_trylock()
147 pthread_mutex_unlock(&mutex->lock); in fio_mutex_down_trylock()
156 pthread_mutex_lock(&mutex->lock); in fio_mutex_down()
160 pthread_cond_wait(&mutex->cond, &mutex->lock); in fio_mutex_down()
165 pthread_mutex_unlock(&mutex->lock); in fio_mutex_down()
174 pthread_mutex_lock(&mutex->lock); in fio_mutex_up()
179 pthread_mutex_unlock(&mutex->lock); in fio_mutex_up()
185 void fio_rwlock_write(struct fio_rwlock *lock) in fio_rwlock_write() argument
187 assert(lock->magic == FIO_RWLOCK_MAGIC); in fio_rwlock_write()
188 pthread_rwlock_wrlock(&lock->lock); in fio_rwlock_write()
191 void fio_rwlock_read(struct fio_rwlock *lock) in fio_rwlock_read() argument
193 assert(lock->magic == FIO_RWLOCK_MAGIC); in fio_rwlock_read()
194 pthread_rwlock_rdlock(&lock->lock); in fio_rwlock_read()
197 void fio_rwlock_unlock(struct fio_rwlock *lock) in fio_rwlock_unlock() argument
199 assert(lock->magic == FIO_RWLOCK_MAGIC); in fio_rwlock_unlock()
200 pthread_rwlock_unlock(&lock->lock); in fio_rwlock_unlock()
203 void fio_rwlock_remove(struct fio_rwlock *lock) in fio_rwlock_remove() argument
205 assert(lock->magic == FIO_RWLOCK_MAGIC); in fio_rwlock_remove()
206 munmap((void *) lock, sizeof(*lock)); in fio_rwlock_remove()
211 struct fio_rwlock *lock; in fio_rwlock_init() local
215 lock = (void *) mmap(NULL, sizeof(struct fio_rwlock), in fio_rwlock_init()
218 if (lock == MAP_FAILED) { in fio_rwlock_init()
220 lock = NULL; in fio_rwlock_init()
224 lock->magic = FIO_RWLOCK_MAGIC; in fio_rwlock_init()
238 ret = pthread_rwlock_init(&lock->lock, &attr); in fio_rwlock_init()
240 ret = pthread_rwlock_init(&lock->lock, NULL); in fio_rwlock_init()
250 return lock; in fio_rwlock_init()
254 if (lock) in fio_rwlock_init()
255 fio_rwlock_remove(lock); in fio_rwlock_init()