Subversion Repositories HelenOS-historic

Compare Revisions

Ignore whitespace Rev 1501 → Rev 1502

/kernel/trunk/generic/include/proc/thread.h
87,6 → 87,7
/** From here, the stored interruption context is restored when sleep is interrupted. */
context_t sleep_interruption_context;
 
bool sleep_interruptible; /**< If true, the thread can be interrupted from sleep. */
waitq_t *sleep_queue; /**< Wait queue in which this thread sleeps. */
timeout_t sleep_timeout; /**< Timeout used for timeoutable sleeping. */
volatile int timeout_pending; /**< Flag signalling sleep timeout in progress. */
/kernel/trunk/generic/include/synch/futex.h
44,7 → 44,7
};
 
extern void futex_init(void);
extern __native sys_futex_sleep_timeout(__address uaddr, __u32 usec, int trydown);
extern __native sys_futex_sleep_timeout(__address uaddr, __u32 usec, int flags);
extern __native sys_futex_wakeup(__address uaddr);
 
#endif
/kernel/trunk/generic/include/synch/condvar.h
39,13 → 39,13
};
 
#define condvar_wait(cv,mtx) \
_condvar_wait_timeout((cv),(mtx),SYNCH_NO_TIMEOUT)
_condvar_wait_timeout((cv),(mtx),SYNCH_NO_TIMEOUT,SYNCH_FLAGS_NONE)
#define condvar_wait_timeout(cv,mtx,usec) \
_condvar_wait_timeout((cv),(mtx),(usec))
_condvar_wait_timeout((cv),(mtx),(usec),SYNCH_FLAGS_NONE)
 
extern void condvar_initialize(condvar_t *cv);
extern void condvar_signal(condvar_t *cv);
extern void condvar_broadcast(condvar_t *cv);
extern int _condvar_wait_timeout(condvar_t *cv, mutex_t *mtx, __u32 usec);
extern int _condvar_wait_timeout(condvar_t *cv, mutex_t *mtx, __u32 usec, int flags);
 
#endif
/kernel/trunk/generic/include/synch/rwlock.h
48,22 → 48,23
};
 
#define rwlock_write_lock(rwl) \
_rwlock_write_lock_timeout((rwl),SYNCH_NO_TIMEOUT,SYNCH_BLOCKING)
_rwlock_write_lock_timeout((rwl),SYNCH_NO_TIMEOUT,SYNCH_FLAGS_NONE)
#define rwlock_read_lock(rwl) \
_rwlock_read_lock_timeout((rwl),SYNCH_NO_TIMEOUT,SYNCH_BLOCKING)
_rwlock_read_lock_timeout((rwl),SYNCH_NO_TIMEOUT,SYNCH_FLAGS_NONE)
#define rwlock_write_trylock(rwl) \
_rwlock_write_lock_timeout((rwl),SYNCH_NO_TIMEOUT,SYNCH_NON_BLOCKING)
_rwlock_write_lock_timeout((rwl),SYNCH_NO_TIMEOUT,SYNCH_FLAGS_NON_BLOCKING)
#define rwlock_read_trylock(rwl) \
_rwlock_read_lock_timeout((rwl),SYNCH_NO_TIMEOUT,SYNCH_NON_BLOCKING)
_rwlock_read_lock_timeout((rwl),SYNCH_NO_TIMEOUT,SYNCH_FLAGS_NON_BLOCKING)
#define rwlock_write_lock_timeout(rwl,usec) \
_rwlock_write_lock_timeout((rwl),(usec),SYNCH_NON_BLOCKING)
_rwlock_write_lock_timeout((rwl),(usec),SYNCH_FLAGS_NONE)
#define rwlock_read_lock_timeout(rwl,usec) \
_rwlock_read_lock_timeout((rwl),(usec),SYNCH_NON_BLOCKING)
_rwlock_read_lock_timeout((rwl),(usec),SYNCH_FLAGS_NONE)
 
extern void rwlock_initialize(rwlock_t *rwl);
extern void rwlock_read_unlock(rwlock_t *rwl);
extern void rwlock_write_unlock(rwlock_t *rwl);
extern int _rwlock_read_lock_timeout(rwlock_t *rwl, __u32 usec, int trylock);
extern int _rwlock_write_lock_timeout(rwlock_t *rwl, __u32 usec, int trylock);
extern int _rwlock_read_lock_timeout(rwlock_t *rwl, __u32 usec, int flags);
extern int _rwlock_write_lock_timeout(rwlock_t *rwl, __u32 usec, int flags);
 
#endif
 
/kernel/trunk/generic/include/synch/mutex.h
39,16 → 39,16
};
 
#define mutex_lock(mtx) \
_mutex_lock_timeout((mtx),SYNCH_NO_TIMEOUT,SYNCH_BLOCKING)
_mutex_lock_timeout((mtx),SYNCH_NO_TIMEOUT,SYNCH_FLAGS_NONE)
#define mutex_trylock(mtx) \
_mutex_lock_timeout((mtx),SYNCH_NO_TIMEOUT,SYNCH_NON_BLOCKING)
_mutex_lock_timeout((mtx),SYNCH_NO_TIMEOUT,SYNCH_FLAGS_NON_BLOCKING)
#define mutex_lock_timeout(mtx,usec) \
_mutex_lock_timeout((mtx),(usec),SYNCH_NON_BLOCKING)
_mutex_lock_timeout((mtx),(usec),SYNCH_FLAGS_NON_BLOCKING)
#define mutex_lock_active(mtx) \
while (mutex_trylock((mtx)) != ESYNCH_OK_ATOMIC)
 
extern void mutex_initialize(mutex_t *mtx);
extern int _mutex_lock_timeout(mutex_t *mtx, __u32 usec, int trylock);
extern int _mutex_lock_timeout(mutex_t *mtx, __u32 usec, int flags);
extern void mutex_unlock(mutex_t *mtx);
 
#endif
/kernel/trunk/generic/include/synch/semaphore.h
40,14 → 40,15
};
 
#define semaphore_down(s) \
_semaphore_down_timeout((s),SYNCH_NO_TIMEOUT,SYNCH_BLOCKING)
_semaphore_down_timeout((s),SYNCH_NO_TIMEOUT,SYNCH_FLAGS_NONE)
#define semaphore_trydown(s) \
_semaphore_down_timeout((s),SYNCH_NO_TIMEOUT,SYNCH_NON_BLOCKING)
_semaphore_down_timeout((s),SYNCH_NO_TIMEOUT,SYNCH_FLAGS_NON_BLOCKING)
#define semaphore_down_timeout(s,usec) \
_semaphore_down_timeout((s),(usec),SYNCH_NON_BLOCKING)
_semaphore_down_timeout((s),(usec),SYNCH_FLAGS_NONE)
 
extern void semaphore_initialize(semaphore_t *s, int val);
extern int _semaphore_down_timeout(semaphore_t *s, __u32 usec, int trydown);
extern int _semaphore_down_timeout(semaphore_t *s, __u32 usec, int flags);
extern void semaphore_up(semaphore_t *s);
 
#endif
 
/kernel/trunk/generic/include/synch/synch.h
30,9 → 30,11
#define __SYNCH_H__
 
#define SYNCH_NO_TIMEOUT 0 /**< Request with no timeout. */
#define SYNCH_BLOCKING 0 /**< Blocking operation request. */
#define SYNCH_NON_BLOCKING 1 /**< Non-blocking operation request. */
 
#define SYNCH_FLAGS_NONE 0 /**< No flags specified. */
#define SYNCH_FLAGS_NON_BLOCKING (1<<0) /**< Non-blocking operation request. */
#define SYNCH_FLAGS_INTERRUPTIBLE (1<<1) /**< Interruptible operation. */
 
#define ESYNCH_WOULD_BLOCK 1 /**< Could not satisfy the request without going to sleep. */
#define ESYNCH_TIMEOUT 2 /**< Timeout occurred. */
#define ESYNCH_INTERRUPTED 4 /**< Sleep was interrupted. */
/kernel/trunk/generic/include/synch/waitq.h
52,12 → 52,12
};
 
#define waitq_sleep(wq) \
waitq_sleep_timeout((wq),SYNCH_NO_TIMEOUT,SYNCH_BLOCKING)
waitq_sleep_timeout((wq),SYNCH_NO_TIMEOUT,SYNCH_FLAGS_NONE)
 
extern void waitq_initialize(waitq_t *wq);
extern int waitq_sleep_timeout(waitq_t *wq, __u32 usec, int nonblocking);
extern int waitq_sleep_timeout(waitq_t *wq, __u32 usec, int flags);
extern ipl_t waitq_sleep_prepare(waitq_t *wq);
extern int waitq_sleep_timeout_unsafe(waitq_t *wq, __u32 usec, int nonblocking);
extern int waitq_sleep_timeout_unsafe(waitq_t *wq, __u32 usec, int flags);
extern void waitq_sleep_finish(waitq_t *wq, int rc, ipl_t ipl);
extern void waitq_wakeup(waitq_t *wq, bool all);
extern void _waitq_wakeup_unsafe(waitq_t *wq, bool all);
/kernel/trunk/generic/include/ipc/ipc.h
209,7 → 209,7
}call_t;
 
extern void ipc_init(void);
extern call_t * ipc_wait_for_call(answerbox_t *box, __u32 usec, int nonblocking);
extern call_t * ipc_wait_for_call(answerbox_t *box, __u32 usec, int flags);
extern void ipc_answer(answerbox_t *box, call_t *request);
extern int ipc_call(phone_t *phone, call_t *call);
extern void ipc_call_sync(phone_t *phone, call_t *request);