|
| static | K_MUTEX_DEFINE (mutex_0) |
| |
| static | K_MUTEX_DEFINE (mutex_1) |
| |
| static void | thread_05 (struct k_sem *wait, struct k_sem *done) |
| | thread_05 -
|
| |
| static void | thread_06 (struct k_sem *wait, struct k_sem *done) |
| | thread_06 -
|
| |
| static void | thread_07 (struct k_sem *wait, struct k_sem *done) |
| | thread_07 -
|
| |
| static void | thread_08 (struct k_sem *wait, struct k_sem *done) |
| | thread_08 -
|
| |
| static | K_THREAD_STACK_DEFINE (thread_05_stack_area,(512+CONFIG_TEST_EXTRA_STACK_SIZE)) |
| |
| static | K_SEM_DEFINE (thread_05_wait, 0, 1) |
| |
| static | K_SEM_DEFINE (thread_05_done, 0, 1) |
| |
| static | K_THREAD_STACK_DEFINE (thread_06_stack_area,(512+CONFIG_TEST_EXTRA_STACK_SIZE)) |
| |
| static | K_SEM_DEFINE (thread_06_wait, 0, 1) |
| |
| static | K_SEM_DEFINE (thread_06_done, 0, 1) |
| |
| static | K_THREAD_STACK_DEFINE (thread_07_stack_area,(512+CONFIG_TEST_EXTRA_STACK_SIZE)) |
| |
| static | K_SEM_DEFINE (thread_07_wait, 0, 1) |
| |
| static | K_SEM_DEFINE (thread_07_done, 0, 1) |
| |
| static | K_THREAD_STACK_DEFINE (thread_08_stack_area,(512+CONFIG_TEST_EXTRA_STACK_SIZE)) |
| |
| static | K_SEM_DEFINE (thread_08_wait, 0, 1) |
| |
| static | K_SEM_DEFINE (thread_08_done, 0, 1) |
| |
| static void | create_participant_threads (void) |
| |
| static void | start_participant_threads (void) |
| |
| static void | join_participant_threads (void) |
| |
| void | test_complex_inversion (void) |
| | Main thread to test mutex locking.
|
| |
Test complex mutex priority inversion.
This module demonstrates the kernel's priority inheritance algorithm with two mutexes and four threads, ensuring that boosting priority of a thread waiting on another mutex does not break assumptions of the mutex's waitq, causing the incorrect thread to run or a crash.
Sequence for priority inheritance testing:
- thread_08 takes mutex_1
- thread_07 takes mutex_0 then waits on mutex_1
- thread_06 waits on mutex_1
- thread_05 waits on mutex_0, boosting priority of thread_07
- thread_08 gives mutex_1, thread_07 takes mutex_1
- thread_07 gives mutex_1, thread_06 takes mutex_1
- thread_07 gives mutex_0, thread_05 takes mutex_0
- thread_06 gives mutex_1
- thread_05 gives mutex_0