<< Previous | Next >>

OSMutexPend

void OSMutexPend( OS_EVENT *pevent, INT16U timeout, INT8U *err );

Description

This function waits for a mutual exclusion semaphore. Note that:

  • The task that owns the Mutex MUST NOT pend on any other event while it owns the mutex.

  • You MUST NOT change the priority of the task that owns the mutex.

Parameters

pevent
Pointer to mutex's event control block.

timeout
Optional timeout period (in clock ticks). If non-zero, your task will wait for the resource up to the amount of time specified by this argument. If you specify 0, however, your task will wait forever at the specified mutex or, until the resource becomes available.

err
Pointer to where an error message will be deposited. Possible error messages are:

OS_NO_ERR - The call was successful and your task owns the mutex

OS_TIMEOUT - The mutex was not available within the specified time.

OS_ERR_EVENT_TYPE - If you didn't pass a pointer to a mutex

OS_ERR_PEVENT_NULL - pevent is a null pointer

OS_ERR_PEND_ISR - If you called this function from an ISR and the result would lead to a suspension.

Library

OS_MUTEX.C


Dynamic C Functions << Previous | Next >> rabbit.com