|
infix
A JIT-Powered FFI Library for C
|
A stress test to detect data races and other threading issues. More...
#include "common/compat_c23.h"#include "common/double_tap.h"#include "common/infix_config.h"#include <infix/infix.h>#include <stdbool.h>#include <pthread.h>#include <stdint.h>Macros | |
| #define | DBLTAP_IMPLEMENTATION |
| #define | NUM_THREADS 8 |
| #define | ITERATIONS_PER_THREAD 500 |
Functions | |
| void | helgrind_test_handler (int a, int b) |
| void * | helgrind_thread_worker (void *arg) |
| subtest ("Thread-safety stress test") | |
Variables | |
| TEST | |
A stress test to detect data races and other threading issues.
This test is designed to be run with a thread sanitizer tool, such as Valgrind's Helgrind or GCC/Clang's -fsanitize=thread (TSan). Its purpose is to verify that the infix library's use of thread-local storage (TLS) for error handling and other contexts is correct and free of data races.
The test spawns multiple threads, and each thread independently runs a tight loop of creating, using, and destroying infix trampolines.
A "pass" for this test is not just that the program completes successfully, but that the thread sanitizer tool reports zero data races or other synchronization errors. This is critical for ensuring that infix is safe to use in multi-threaded applications.
| #define DBLTAP_IMPLEMENTATION |
| #define ITERATIONS_PER_THREAD 500 |
| #define NUM_THREADS 8 |
| void helgrind_test_handler | ( | int | a, |
| int | b | ||
| ) |
| void * helgrind_thread_worker | ( | void * | arg | ) |
| subtest | ( | "Thread-safety stress test" | ) |