|
ZTEST_BMEM | SYS_MUTEX_DEFINE (private_mutex) |
|
ZTEST_BMEM | SYS_MUTEX_DEFINE (mutex_1) |
|
ZTEST_BMEM | SYS_MUTEX_DEFINE (mutex_2) |
|
ZTEST_BMEM | SYS_MUTEX_DEFINE (mutex_3) |
|
ZTEST_BMEM | SYS_MUTEX_DEFINE (mutex_4) |
|
static | SYS_MUTEX_DEFINE (no_access_mutex) |
|
static ZTEST_BMEM | SYS_MUTEX_DEFINE (not_my_mutex) |
|
static ZTEST_BMEM | SYS_MUTEX_DEFINE (bad_count_mutex) |
|
void | test_mutex_multithread_competition (void) |
| Test multi-threads to take mutex. More...
|
|
void | thread_05 (void) |
|
void | thread_06 (void) |
|
void | thread_07 (void) |
|
void | thread_08 (void) |
|
void | thread_09 (void) |
|
void | thread_11 (void) |
|
| K_THREAD_STACK_DEFINE (thread_12_stack_area,(512+CONFIG_TEST_EXTRA_STACKSIZE)) |
|
void | thread_12 (void) |
|
void | test_mutex (void) |
| Main thread to test thread_mutex_xxx interfaces. More...
|
|
void | test_supervisor_access (void) |
|
void | test_user_access (void) |
|
| K_THREAD_DEFINE (THREAD_05,(512+CONFIG_TEST_EXTRA_STACKSIZE), thread_05, NULL, NULL, NULL, 5, K_USER, 0) |
|
| K_THREAD_DEFINE (THREAD_06,(512+CONFIG_TEST_EXTRA_STACKSIZE), thread_06, NULL, NULL, NULL, 6, K_USER, 0) |
|
| K_THREAD_DEFINE (THREAD_07,(512+CONFIG_TEST_EXTRA_STACKSIZE), thread_07, NULL, NULL, NULL, 7, K_USER, 0) |
|
| K_THREAD_DEFINE (THREAD_08,(512+CONFIG_TEST_EXTRA_STACKSIZE), thread_08, NULL, NULL, NULL, 8, K_USER, 0) |
|
| K_THREAD_DEFINE (THREAD_09,(512+CONFIG_TEST_EXTRA_STACKSIZE), thread_09, NULL, NULL, NULL, 9, K_USER, 0) |
|
| K_THREAD_DEFINE (THREAD_11,(512+CONFIG_TEST_EXTRA_STACKSIZE), thread_11, NULL, NULL, NULL, 11, K_USER, 0) |
|
void | test_main (void) |
|
Test kernel mutex APIs.
This module demonstrates the kernel's priority inheritance algorithm. A thread that owns a mutex is promoted to the priority level of the highest-priority thread attempting to lock the mutex.
In addition, recursive locking capabilities and the use of a private mutex are also tested.
This module tests the following mutex routines:
sys_mutex_lock sys_mutex_unlock
Timeline for priority inheritance testing:
- 0.0 sec: thread_05, thread_06, thread_07, thread_08, thread_09, sleep : main thread takes mutex_1 then sleeps
- 0.0 sec: thread_11 sleeps
- 0.5 sec: thread_09 wakes and waits on mutex_1
- 1.0 sec: main thread (@ priority 9) takes mutex_2 then sleeps
- 1.5 sec: thread_08 wakes and waits on mutex_2
- 2.0 sec: main thread (@ priority 8) takes mutex_3 then sleeps
- 2.5 sec: thread_07 wakes and waits on mutex_3
- 3.0 sec: main thread (@ priority 7) takes mutex_4 then sleeps
- 3.5 sec: thread_05 wakes and waits on mutex_4
- 3.5 sec: thread_11 wakes and waits on mutex_3
- 3.75 sec: thread_06 wakes and waits on mutex_4
- 4.0 sec: main thread wakes (@ priority 5) then sleeps
- 4.5 sec: thread_05 times out
- 5.0 sec: main thread wakes (@ priority 6) then gives mutex_4 : main thread (@ priority 7) sleeps
- 5.5 sec: thread_07 times out on mutex_3
- 6.0 sec: main thread (@ priority 8) gives mutex_3 : main thread (@ priority 8) gives mutex_2 : main thread (@ priority 9) gives mutex_1 : main thread (@ priority 10) sleeps