<< Previous | Next >>

OSMutexDel

OS_EVENT *OSMutexDel( OS_EVENT * pevent, INT8U opt, INT8U * err );

Description

This function deletes a mutual exclusion semaphore and readies all tasks pending on it. Note that:

  • This function must be used with care. Tasks that would normally expect the presence of the mutex MUST check the return code of OSMutexPend().

  • This call can potentially disable interrupts for a long time. The interrupt disable time is directly proportional to the number of tasks waiting on the mutex.

  • Because ALL tasks pending on the mutex will be readied, you MUST be careful because the resource(s) will no longer be guarded by the mutex.

Parameters

pevent
Pointer to mutex's event control block.

opt
May be one of the following delete options:

  • OS_DEL_NO_PEND - Delete mutex only if no task pending

  • OS_DEL_ALWAYS - Deletes the mutex even if tasks are waiting. In this case, all pending tasks will be readied.

err
Pointer to an error code that can contain one of the following values:

  • OS_NO_ERR - The call was successful and the mutex was deleted

  • OS_ERR_DEL_ISR - Attempted to delete the mutex from an ISR

  • OS_ERR_INVALID_OPT - An invalid option was specified

  • OS_ERR_TASK_WAITING - One or more tasks were waiting on the mutex

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

Return value

pevent
On error.

(OS_EVENT *)0
Mutex was deleted.

Library

OS_MUTEX.C


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