Subversion Repositories HelenOS

Compare Revisions

Ignore whitespace Rev 2105 → Rev 2106

/trunk/kernel/generic/include/synch/synch.h
35,20 → 35,31
#ifndef KERN_SYNCH_H_
#define KERN_SYNCH_H_
 
#define SYNCH_NO_TIMEOUT 0 /**< Request with no timeout. */
/** Request with no timeout. */
#define SYNCH_NO_TIMEOUT 0
 
#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. */
/** No flags specified. */
#define SYNCH_FLAGS_NONE 0
/** Non-blocking operation request. */
#define SYNCH_FLAGS_NON_BLOCKING (1 << 0)
/** Interruptible operation. */
#define SYNCH_FLAGS_INTERRUPTIBLE (1 << 1)
 
#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. */
#define ESYNCH_OK_ATOMIC 8 /**< Operation succeeded without sleeping. */
#define ESYNCH_OK_BLOCKED 16 /**< Operation succeeded and did sleep. */
/** Could not satisfy the request without going to sleep. */
#define ESYNCH_WOULD_BLOCK 1
/** Timeout occurred. */
#define ESYNCH_TIMEOUT 2
/** Sleep was interrupted. */
#define ESYNCH_INTERRUPTED 4
/** Operation succeeded without sleeping. */
#define ESYNCH_OK_ATOMIC 8
/** Operation succeeded and did sleep. */
#define ESYNCH_OK_BLOCKED 16
 
#define SYNCH_FAILED(rc) ((rc) & (ESYNCH_WOULD_BLOCK | ESYNCH_TIMEOUT | ESYNCH_INTERRUPTED))
#define SYNCH_OK(rc) ((rc) & (ESYNCH_OK_ATOMIC | ESYNCH_OK_BLOCKED))
#define SYNCH_FAILED(rc) \
((rc) & (ESYNCH_WOULD_BLOCK | ESYNCH_TIMEOUT | ESYNCH_INTERRUPTED))
#define SYNCH_OK(rc) \
((rc) & (ESYNCH_OK_ATOMIC | ESYNCH_OK_BLOCKED))
 
#endif