Subversion Repositories HelenOS

Rev

Rev 534 | Rev 1502 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 534 Rev 623
Line 31... Line 31...
31
 
31
 
32
#include <arch/types.h>
32
#include <arch/types.h>
33
#include <typedefs.h>
33
#include <typedefs.h>
34
#include <synch/mutex.h>
34
#include <synch/mutex.h>
35
#include <synch/synch.h>
35
#include <synch/synch.h>
-
 
36
#include <synch/spinlock.h>
36
 
37
 
37
enum rwlock_type {
38
enum rwlock_type {
38
    RWLOCK_NONE,
39
    RWLOCK_NONE,
39
    RWLOCK_READER,
40
    RWLOCK_READER,
40
    RWLOCK_WRITER
41
    RWLOCK_WRITER
41
};
42
};
42
 
43
 
43
struct rwlock {
44
struct rwlock {
44
    spinlock_t lock;
45
    SPINLOCK_DECLARE(lock);
45
    mutex_t exclusive;  /**< Mutex for writers, readers can bypass it if readers_in is positive. */
46
    mutex_t exclusive;  /**< Mutex for writers, readers can bypass it if readers_in is positive. */
46
    count_t readers_in; /**< Number of readers in critical section. */
47
    count_t readers_in; /**< Number of readers in critical section. */
47
};
48
};
48
 
49
 
49
#define rwlock_write_lock(rwl) \
50
#define rwlock_write_lock(rwl) \