ARM Technical Support Knowledge Articles

MUTEX BEHAVIOR

Applies to: Advanced RTOS

Answer


Information in this article applies to:


SYMPTOM

In an ARTX realtime library program, if I have a task waiting on a mutex "or" a timeout, it may never become active.

CAUSE

If another task releases then takes back a mutex, without passing control back to the kernel, a task waiting on that mutex may repeatedly become active, then get put back in the waiting queue. When that happens, the waiting task's timeout counter gets reset to zero.

RESOLUTION

A task that releases, and then re-claims a mutex, can force a task switch in between those operations, by calling the os_tsk_pass() kernel function.

For example:

os_mut_release();
... // do something, no task switch here
os_tsk_pass();
os_mut_wait();

Since any task waiting on a mutex will get put at the front of the waiting queue, when another task releases the mutex, that task will be the next to run, when the kernel regains control.

STATUS

Work-around available

Article last edited on: 2007-01-10 10:16:53

Rate this article

[Bad]
|
|
[Good]
Disagree? Move your mouse over the bar and click

Did you find this article helpful? Yes No

How can we improve this article?

Link to this article
Copyright © 2011 ARM Limited. All rights reserved. External (Open), Non-Confidential