Linux Audio

Check our new training course

Loading...
v5.4
 1#ifndef _PERF_RWSEM_H
 2#define _PERF_RWSEM_H
 3
 4#include <pthread.h>
 
 
 
 
 
 
 
 5
 6struct rw_semaphore {
 
 
 
 7	pthread_rwlock_t lock;
 
 8};
 9
10int init_rwsem(struct rw_semaphore *sem);
11int exit_rwsem(struct rw_semaphore *sem);
12
13int down_read(struct rw_semaphore *sem);
14int up_read(struct rw_semaphore *sem);
15
16int down_write(struct rw_semaphore *sem);
17int up_write(struct rw_semaphore *sem);
18
19#endif /* _PERF_RWSEM_H */
v6.8
 1#ifndef _PERF_RWSEM_H
 2#define _PERF_RWSEM_H
 3
 4#include <pthread.h>
 5#include "mutex.h"
 6
 7/*
 8 * Mutexes have additional error checking. Enable to use a mutex rather than a
 9 * rwlock for debugging.
10 */
11#define RWS_ERRORCHECK 0
12
13struct rw_semaphore {
14#if RWS_ERRORCHECK
15	struct mutex mtx;
16#else
17	pthread_rwlock_t lock;
18#endif
19};
20
21int init_rwsem(struct rw_semaphore *sem);
22int exit_rwsem(struct rw_semaphore *sem);
23
24int down_read(struct rw_semaphore *sem);
25int up_read(struct rw_semaphore *sem);
26
27int down_write(struct rw_semaphore *sem);
28int up_write(struct rw_semaphore *sem);
29
30#endif /* _PERF_RWSEM_H */