<< Previous | Next >>

OSMutexAccept

INT8U OSMutexAccept( OS_EVENT * pevent, INT8U * err );

Description

This function checks the mutual exclusion semaphore to see if a resource is available. Unlike OSMutexPend(), OSMutexAccept() does not suspend the calling task if the resource is not available or the event did not occur. This function cannot be called from an ISR because mutual exclusion semaphores are intended to be used by tasks only.

Parameters

pevent
Pointer to the event control block.

err
Pointer to an error code that will be returned to your application:

  • OS_NO_ERR - if the call was successful.

  • OS_ERR_EVENT_TYPE - if pevent is not 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

Return value

1: Success, the resource is available and the mutual exclusion semaphore is acquired.

0: Error, either the resource is not available, or you didn't pass a pointer to a mutual exclusion semaphore, or you called this function from an ISR.

Library

OS_MUTEX.C


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