Problem
The C SDK has thread safety concerns that need to be addressed:
Issues Found
- Global allocator is unprotected - \g_allocator\ in \ ypes.c\ is mutable global state with no synchronization
- \js_init()/\js_cleanup()\ are not thread-safe - Modifying global allocator during active validations causes undefined behavior
- \js_cleanup()\ doesn't clear regex cache - Should call \js_regex_cache_clear()\
Current Behavior
- Validators are safe for concurrent use IF \js_init()\ is called once before any threads start
- \js_set_allocator()\ must NEVER be called while validators are active
- Each thread must use its own \js_result_t\ for results
Required Changes
- Add thread safety documentation to README
- Fix \js_cleanup()\ to clear the regex cache
- Consider making \g_allocator\ immutable after initialization (optional)
Tests to Add
Thread Safety Classification
Partially Thread-Safe - Safe with proper usage patterns documented
Problem
The C SDK has thread safety concerns that need to be addressed:
Issues Found
Current Behavior
Required Changes
Tests to Add
Thread Safety Classification
Partially Thread-Safe - Safe with proper usage patterns documented