Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

void  OSMutexDel (OS_MUTEX  *p_mutex,

...

                  OS_OPT     opt,

...

                  OS_ERR    *p_err)

...

...

File

...

Called from

...

Code enabled by

...

...

os_mutex.c

...

Task only

...

...

OS_CFG_MUTEX_EN and OS_CFG_MUTEX_DEL_EN

...

10012421001242OSMutexDel() is used to delete a mutex. This function should be used with care because multiple tasks may rely on the presence of the mutex. Generally speaking, before deleting a mutex, first delete all the tasks that access the mutex. However, as a general rule, do not delete kernel objects at run-time. Anchor10012431001243

Arguments

...

p_mutex Anchor10012451001245

is a pointer to the mutex to delete.

Anchor10012461001246opt Anchor10012471001247

specifies whether to delete the mutex only if there are no pending tasks (OS_OPT_DEL_NO_PEND), or whether to always delete the mutex regardless of whether tasks are pending or not (OS_OPT_DEL_ALWAYS). In this case, all pending tasks are readied.

...

p_err Anchor10012491001249

is a pointer to a variable that is used to hold an error code:

...

classWebWorks_Indent_1

...

OS_ERR_NONE

...

classWebWorks_Indent_2

...

if the call is successful and the mutex has been deleted.

...

...

OS_ERR_DEL_ISR

...

classWebWorks_Indent_2

...

...

if OS_CFG_CALLED_FROM_ISR_CHK_EN set to 1 in os_cfg.h: if attempting to delete a mutex from an ISR.

...

classWebWorks_Indent_1

...

OS_ERR_OBJ_PTR_NULL

...

...

if OS_CFG_ARG_CHK_EN is set to 1 in os_cfg.h: if p_mutex is a NULL pointer.

...

classWebWorks_Indent_1

...

OS_ERR_OBJ_TYPE

...

classWebWorks_Indent_2

...

if OS_CFG_OBJ_TYPE_CHK_EN is set to 1 in os_cfg.h: if p_mutex is not pointing to a mutex.

...

classWebWorks_Indent_1

...

OS_ERR_OPT_INVALID

...

...

if the user does not specify one of the two options mentioned in the opt argument.

...

classWebWorks_Indent_1

...

OS_ERR_TASK_WAITING

...

classWebWorks_Indent_2

...

if one or more task are waiting on the mutex and OS_OPT_DEL_NO_PEND is specified.

...

Returned Value

...

10012631001263The number of tasks that were waiting for the mutex and 0 if an error occurred.anchor10507221050722

Notes/Warnings

Anchor10507231050723Use this call with care as other tasks may expect the presence of the mutex. Anchor10507761050776

Example

...

rowspan16

...