Subversion Repositories HelenOS-historic

Compare Revisions

Ignore whitespace Rev 387 → Rev 404

/SPARTAN/trunk/src/synch/mutex.c
46,7 → 46,7
* Acquire mutex.
* Timeout mode and non-blocking mode can be requested.
*
* @param mxt Mutex.
* @param mtx Mutex.
* @param usec Timeout in microseconds.
* @param trylock Switches between blocking and non-blocking mode.
*
/SPARTAN/trunk/src/synch/waitq.c
108,29 → 108,32
* and all the *_timeout() functions use it.
*
* @param wq Pointer to wait queue.
* @param usec Timeout value in microseconds.
* @param nonblocking Controls whether only a conditional sleep
* (non-blocking sleep) is called for when the usec argument is 0.
* @param usec Timeout in microseconds.
* @param nonblocking Blocking vs. non-blocking operation mode switch.
*
* Relation between 'usec' and 'nonblocking' is described by this table:
* If usec is greater than zero, regardless of the value of @nonblocking,
* the call will not return until either timeout or wakeup comes.
*
* usec | nonblocking | what happens if there is no missed_wakeup
* -----+-------------+--------------------------------------------
* 0 | 0 | blocks without timeout until wakeup
* 0 | <> 0 | immediately returns ESYNCH_WOULD_BLOCK
* > 0 | x | blocks with timeout until timeout or wakeup
* 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
* immediately return, reporting either success or failure.
*
* @return Returns one of: ESYNCH_WOULD_BLOCK, ESYNCH_TIMEOUT,
* ESYNCH_OK_ATOMIC, ESYNCH_OK_BLOCKED.
*
* Meaning of the return values is described by the following chart:
* ESYNCH_WOULD_BLOCK means that the sleep failed because at the time
* of the call there was no pending wakeup.
*
* ESYNCH_WOULD_BLOCK Sleep failed because at the time of the call,
* there was no pending wakeup.
* ESYNCH_TIMEOUT Sleep timed out.
* ESYNCH_OK_ATOMIC Sleep succeeded; at the time of the call,
* where was a pending wakeup.
* ESYNCH_OK_BLOCKED Sleep succeeded; the full sleep was attempted.
* ESYNCH_TIMEOUT means that the sleep timed out.
*
* 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
* attempted.
*/
int waitq_sleep_timeout(waitq_t *wq, __u32 usec, int nonblocking)
{
/SPARTAN/trunk/src/synch/condvar.c
47,7 → 47,7
* Signal the condition has become true
* to the first waiting thread by waking it up.
*
* @param Condition variable.
* @param cv Condition variable.
*/
void condvar_signal(condvar_t *cv)
{
59,7 → 59,7
* Signal the condition has become true
* to all waiting threads by waking them up.
*
* @param Condition variable.
* @param cv Condition variable.
*/
void condvar_broadcast(condvar_t *cv)
{
70,7 → 70,15
*
* Wait for the condition becoming true.
*
* @param Condition variable.
* @param cv Condition variable.
* @param mtx Mutex.
* @param usec Timeout value in microseconds.
* @param trywait Blocking versus non-blocking operation mode switch.
*
* For exact description of possible combinations of
* 'usec' and 'trywait', see comment for waitq_sleep_timeout().
*
* @return See comment for waitq_sleep_timeout().
*/
int _condvar_wait_timeout(condvar_t *cv, mutex_t *mtx, __u32 usec, int trywait)
{