Subversion Repositories HelenOS-historic

Compare Revisions

Ignore whitespace Rev 1247 → Rev 1248

/kernel/trunk/generic/src/synch/waitq.c
26,6 → 26,18
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
 
/**
* @file waitq.c
* @brief Wait queue.
*
* Wait queue is the basic synchronization primitive upon all
* other synchronization primitives build.
*
* It allows threads to wait for an event in first-come, first-served
* fashion. Conditional operation as well as timeouts and interruptions
* are supported.
*/
 
#include <synch/waitq.h>
#include <synch/synch.h>
#include <synch/spinlock.h>
160,30 → 172,30
* @param usec Timeout in microseconds.
* @param nonblocking Blocking vs. non-blocking operation mode switch.
*
* If @usec is greater than zero, regardless of the value of @nonblocking,
* If usec is greater than zero, regardless of the value of nonblocking,
* the call will not return until either timeout or wakeup comes.
*
* If @usec is zero and @nonblocking is zero (false), the call
* If usec is zero and @nonblocking is zero (false), the call
* will not return until wakeup comes.
*
* If @usec is zero and @nonblocking is non-zero (true), the call will
* If usec is zero and nonblocking is non-zero (true), the call will
* immediately return, reporting either success or failure.
*
* @return Returns one of: ESYNCH_WOULD_BLOCK, ESYNCH_TIMEOUT,
* ESYNCH_OK_ATOMIC, ESYNCH_OK_BLOCKED.
* @return Returns one of: ESYNCH_WOULD_BLOCK, ESYNCH_TIMEOUT,
* ESYNCH_OK_ATOMIC, ESYNCH_OK_BLOCKED.
*
* ESYNCH_WOULD_BLOCK means that the sleep failed because at the time
* @li ESYNCH_WOULD_BLOCK means that the sleep failed because at the time
* of the call there was no pending wakeup.
*
* ESYNCH_TIMEOUT means that the sleep timed out.
* @li ESYNCH_TIMEOUT means that the sleep timed out.
*
* ESYNCH_INTERRUPTED means that somebody interrupted the sleeping thread.
* @li ESYNCH_INTERRUPTED means that somebody interrupted the sleeping thread.
*
* ESYNCH_OK_ATOMIC means that the sleep succeeded and that there was
* @li ESYNCH_OK_ATOMIC means that the sleep succeeded and that there was
* a pending wakeup at the time of the call. The caller was not put
* asleep at all.
*
* ESYNCH_OK_BLOCKED means that the sleep succeeded; the full sleep was
* @li ESYNCH_OK_BLOCKED means that the sleep succeeded; the full sleep was
* attempted.
*/
int waitq_sleep_timeout(waitq_t *wq, __u32 usec, int nonblocking)