Subversion Repositories HelenOS-historic

Compare Revisions

Ignore whitespace Rev 223 → Rev 410

/SPARTAN/trunk/include/synch/rwlock.h
42,8 → 42,8
 
struct rwlock {
spinlock_t lock;
mutex_t exclusive;
int readers_in;
mutex_t exclusive; /**< Mutex for writers, readers can bypass it if readers_in is positive. */
int readers_in; /**< Number of readers in critical section. */
};
 
#define rwlock_write_lock(rwl) \
/SPARTAN/trunk/include/synch/synch.h
29,14 → 29,14
#ifndef __SYNCH_H__
#define __SYNCH_H__
 
#define SYNCH_NO_TIMEOUT 0
#define SYNCH_BLOCKING 0
#define SYNCH_NON_BLOCKING 1
#define SYNCH_NO_TIMEOUT 0 /**< No timeout is request. */
#define SYNCH_BLOCKING 0 /**< Blocking operation request. */
#define SYNCH_NON_BLOCKING 1 /**< Non-blocking operation request. */
 
#define ESYNCH_WOULD_BLOCK 1
#define ESYNCH_TIMEOUT 2
#define ESYNCH_OK_ATOMIC 4
#define ESYNCH_OK_BLOCKED 8
#define ESYNCH_WOULD_BLOCK 1 /**< Could not satisfy the request without going to sleep. */
#define ESYNCH_TIMEOUT 2 /**< Timeout occurred. */
#define ESYNCH_OK_ATOMIC 4 /**< Operation succeeded without sleeping. */
#define ESYNCH_OK_BLOCKED 8 /**< Operation succeeded and did sleep. */
 
#define SYNCH_FAILED(rc) ((rc) & (ESYNCH_WOULD_BLOCK | ESYNCH_TIMEOUT))
#define SYNCH_OK(rc) ((rc) & (ESYNCH_OK_ATOMIC | ESYNCH_OK_BLOCKED))
/SPARTAN/trunk/include/synch/waitq.h
40,8 → 40,8
 
struct waitq {
spinlock_t lock;
int missed_wakeups;
link_t head;
int missed_wakeups; /**< Number of waitq_wakeup() calls that didn't find a thread to wake up. */
link_t head; /**< List of sleeping threads for wich there was no missed_wakeup. */
};
 
#define waitq_sleep(wq) \