|
Zephyr API Documentation 4.1.99
A Scalable Open Source RTOS
|
Functions | |
| void | test_atomic (void) |
| Verify atomic functionalities. | |
| void | atomic_handler (void *p1, void *p2, void *p3) |
| void | test_threads_access_atomic (void) |
| Verify atomic operation with threads. | |
| void | test_atomic_overflow (void) |
| Checks that the value of atomic_t will be the same in case of overflow if incremented in atomic and non-atomic manner. | |
| void atomic_handler | ( | void * | p1, |
| void * | p2, | ||
| void * | p3 ) |
| void test_atomic | ( | void | ) |
#include </home/runner/work/safety-doc/zephyr/tests/kernel/common/src/atomic.c>
Verify atomic functionalities.
Test Objective:
Test techniques:
Prerequisite Conditions:
Input Specifications:
Test Procedure:
Expected Test Result:
Pass/Fail Criteria:
Assumptions and Constraints:
| void test_atomic_overflow | ( | void | ) |
#include </home/runner/work/safety-doc/zephyr/tests/kernel/common/src/atomic.c>
Checks that the value of atomic_t will be the same in case of overflow if incremented in atomic and non-atomic manner.
According to C standard the value of a signed variable is undefined in case of overflow. This test checks that the value of atomic_t will be the same in case of overflow if incremented in atomic and non-atomic manner. This allows us to increment an atomic variable in a non-atomic manner (as long as it is logically safe) and expect its value to match the result of the similar atomic increment.
| void test_threads_access_atomic | ( | void | ) |
#include </home/runner/work/safety-doc/zephyr/tests/kernel/common/src/atomic.c>
Verify atomic operation with threads.
Creat two preempt threads with equal priority to atomically access the same atomic value. Because these preempt threads are of equal priority, so enable time slice to make them scheduled. The thread will execute for some time. In this time, the two sub threads will be scheduled separately according to the time slice.