Subversion Repositories HelenOS

Compare Revisions

Ignore whitespace Rev 2084 → Rev 2085

/trunk/kernel/generic/include/synch/futex.h
42,12 → 42,12
#include <genarch/mm/page_pt.h>
 
/** Kernel-side futex structure. */
struct futex {
typedef struct {
uintptr_t paddr; /**< Physical address of the status variable. */
waitq_t wq; /**< Wait queue for threads waiting for futex availability. */
link_t ht_link; /**< Futex hash table link. */
count_t refcount; /**< Number of tasks that reference this futex. */
};
} futex_t;
 
extern void futex_init(void);
extern unative_t sys_futex_sleep_timeout(uintptr_t uaddr, uint32_t usec, int flags);
/trunk/kernel/generic/include/synch/condvar.h
37,12 → 37,12
 
#include <arch/types.h>
#include <synch/waitq.h>
#include <typedefs.h>
#include <synch/mutex.h>
#include <synch/synch.h>
 
struct condvar {
typedef struct {
waitq_t wq;
};
} condvar_t;
 
#define condvar_wait(cv,mtx) \
_condvar_wait_timeout((cv),(mtx),SYNCH_NO_TIMEOUT,SYNCH_FLAGS_NONE)
/trunk/kernel/generic/include/synch/rwlock.h
41,17 → 41,17
#include <synch/synch.h>
#include <synch/spinlock.h>
 
enum rwlock_type {
typedef enum {
RWLOCK_NONE,
RWLOCK_READER,
RWLOCK_WRITER
};
} rwlock_type_t;
 
struct rwlock {
typedef struct {
SPINLOCK_DECLARE(lock);
mutex_t exclusive; /**< Mutex for writers, readers can bypass it if readers_in is positive. */
count_t readers_in; /**< Number of readers in critical section. */
};
} rwlock_t;
 
#define rwlock_write_lock(rwl) \
_rwlock_write_lock_timeout((rwl),SYNCH_NO_TIMEOUT,SYNCH_FLAGS_NONE)
/trunk/kernel/generic/include/synch/mutex.h
40,9 → 40,9
#include <synch/semaphore.h>
#include <synch/synch.h>
 
struct mutex {
typedef struct {
semaphore_t sem;
};
} mutex_t;
 
#define mutex_lock(mtx) \
_mutex_lock_timeout((mtx),SYNCH_NO_TIMEOUT,SYNCH_FLAGS_NONE)
/trunk/kernel/generic/include/synch/spinlock.h
42,12 → 42,12
#include <debug.h>
 
#ifdef CONFIG_SMP
struct spinlock {
typedef struct {
#ifdef CONFIG_DEBUG_SPINLOCK
char *name;
#endif
atomic_t val;
};
} spinlock_t;
 
/*
* SPINLOCK_DECLARE is to be used for dynamically allocated spinlocks,
103,6 → 103,8
 
#else
 
typedef void spinlock_t;
 
/* On UP systems, spinlocks are effectively left out. */
#define SPINLOCK_DECLARE(name)
#define SPINLOCK_INITIALIZE(name)
/trunk/kernel/generic/include/synch/semaphore.h
40,10 → 40,9
#include <synch/waitq.h>
#include <synch/synch.h>
 
struct semaphore
{
typedef struct {
waitq_t wq;
};
} semaphore_t;
 
#define semaphore_down(s) \
_semaphore_down_timeout((s),SYNCH_NO_TIMEOUT,SYNCH_FLAGS_NONE)
/trunk/kernel/generic/include/synch/waitq.h
45,7 → 45,7
#define WAKEUP_ALL 1
 
/** Wait queue structure. */
struct waitq {
typedef struct {
 
/** Lock protecting wait queue structure.
*
55,7 → 55,7
 
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. */
};
} waitq_t;
 
#define waitq_sleep(wq) \
waitq_sleep_timeout((wq),SYNCH_NO_TIMEOUT,SYNCH_FLAGS_NONE)