|
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 | thread_05 (void *p1, void *p2, void *p3) |
| thread_05 -
|
|
void | thread_06 (void *p1, void *p2, void *p3) |
| thread_06 -
|
|
void | thread_07 (void *p1, void *p2, void *p3) |
| thread_07 -
|
|
void | thread_08 (void *p1, void *p2, void *p3) |
| thread_08 -
|
|
void | thread_09 (void *p1, void *p2, void *p3) |
| thread_09 -
|
|
void | thread_11 (void *p1, void *p2, void *p3) |
| thread_11 -
|
|
| K_THREAD_STACK_DEFINE (thread_12_stack_area,(512+CONFIG_TEST_EXTRA_STACK_SIZE)) |
|
void | thread_12 (void *p1, void *p2, void *p3) |
| thread_12 - thread that participates in recursive locking tests
|
|
| K_THREAD_STACK_DEFINE (thread_05_stack_area,(512+CONFIG_TEST_EXTRA_STACK_SIZE)) |
|
| K_THREAD_STACK_DEFINE (thread_06_stack_area,(512+CONFIG_TEST_EXTRA_STACK_SIZE)) |
|
| K_THREAD_STACK_DEFINE (thread_07_stack_area,(512+CONFIG_TEST_EXTRA_STACK_SIZE)) |
|
| K_THREAD_STACK_DEFINE (thread_08_stack_area,(512+CONFIG_TEST_EXTRA_STACK_SIZE)) |
|
| K_THREAD_STACK_DEFINE (thread_09_stack_area,(512+CONFIG_TEST_EXTRA_STACK_SIZE)) |
|
| K_THREAD_STACK_DEFINE (thread_11_stack_area,(512+CONFIG_TEST_EXTRA_STACK_SIZE)) |
|
void | create_participant_threads (void) |
|
void | start_participant_threads (void) |
|
void | join_participant_threads (void) |
|
| ZTEST_USER (mutex_complex, test_mutex) |
| Main thread to test thread_mutex_xxx interfaces.
|
|
| ZTEST (mutex_complex, test_supervisor_access) |
|
| ZTEST_USER (mutex_complex, test_user_access) |
|
static void * | sys_mutex_tests_setup (void) |
|
| ZTEST_SUITE (mutex_complex, NULL, sys_mutex_tests_setup, NULL, NULL, NULL) |
|
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