Subversion Repositories HelenOS-historic

Rev

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

Rev 623 Rev 1502
Line 46... Line 46...
46
    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. */
47
    count_t readers_in; /**< Number of readers in critical section. */
47
    count_t readers_in; /**< Number of readers in critical section. */
48
};
48
};
49
 
49
 
50
#define rwlock_write_lock(rwl) \
50
#define rwlock_write_lock(rwl) \
51
    _rwlock_write_lock_timeout((rwl),SYNCH_NO_TIMEOUT,SYNCH_BLOCKING)
51
    _rwlock_write_lock_timeout((rwl),SYNCH_NO_TIMEOUT,SYNCH_FLAGS_NONE)
52
#define rwlock_read_lock(rwl) \
52
#define rwlock_read_lock(rwl) \
53
    _rwlock_read_lock_timeout((rwl),SYNCH_NO_TIMEOUT,SYNCH_BLOCKING)
53
    _rwlock_read_lock_timeout((rwl),SYNCH_NO_TIMEOUT,SYNCH_FLAGS_NONE)
54
#define rwlock_write_trylock(rwl) \
54
#define rwlock_write_trylock(rwl) \
55
    _rwlock_write_lock_timeout((rwl),SYNCH_NO_TIMEOUT,SYNCH_NON_BLOCKING)
55
    _rwlock_write_lock_timeout((rwl),SYNCH_NO_TIMEOUT,SYNCH_FLAGS_NON_BLOCKING)
56
#define rwlock_read_trylock(rwl) \
56
#define rwlock_read_trylock(rwl) \
57
    _rwlock_read_lock_timeout((rwl),SYNCH_NO_TIMEOUT,SYNCH_NON_BLOCKING)
57
    _rwlock_read_lock_timeout((rwl),SYNCH_NO_TIMEOUT,SYNCH_FLAGS_NON_BLOCKING)
58
#define rwlock_write_lock_timeout(rwl,usec) \
58
#define rwlock_write_lock_timeout(rwl,usec) \
59
    _rwlock_write_lock_timeout((rwl),(usec),SYNCH_NON_BLOCKING)
59
    _rwlock_write_lock_timeout((rwl),(usec),SYNCH_FLAGS_NONE)
60
#define rwlock_read_lock_timeout(rwl,usec) \
60
#define rwlock_read_lock_timeout(rwl,usec) \
61
    _rwlock_read_lock_timeout((rwl),(usec),SYNCH_NON_BLOCKING)
61
    _rwlock_read_lock_timeout((rwl),(usec),SYNCH_FLAGS_NONE)
62
 
62
 
63
extern void rwlock_initialize(rwlock_t *rwl);
63
extern void rwlock_initialize(rwlock_t *rwl);
64
extern void rwlock_read_unlock(rwlock_t *rwl);
64
extern void rwlock_read_unlock(rwlock_t *rwl);
65
extern void rwlock_write_unlock(rwlock_t *rwl);
65
extern void rwlock_write_unlock(rwlock_t *rwl);
66
extern int _rwlock_read_lock_timeout(rwlock_t *rwl, __u32 usec, int trylock);
66
extern int _rwlock_read_lock_timeout(rwlock_t *rwl, __u32 usec, int flags);
67
extern int _rwlock_write_lock_timeout(rwlock_t *rwl, __u32 usec, int trylock);
67
extern int _rwlock_write_lock_timeout(rwlock_t *rwl, __u32 usec, int flags);
68
 
68
 
69
#endif
69
#endif
-
 
70