| 175 | } |
| 176 | |
| 177 | static int DeinitWithCounter(void* h) { |
| 178 | auto* counter = static_cast<ThreadSafeCounter*>(h); |
| 179 | if (counter->deinit_count_ptr) { |
| 180 | counter->deinit_count_ptr->fetch_add(1, std::memory_order_relaxed); |
| 181 | } |
| 182 | // Small delay to increase the race window |
| 183 | std::this_thread::sleep_for(std::chrono::microseconds(100)); |
| 184 | delete counter; |
| 185 | return 0; |
| 186 | } |
| 187 | |
| 188 | TEST(CEnvAPI, TVMFFIHandleInitDeinitOnceMultithreaded) { |
| 189 | // Test 1: Multiple threads calling InitOnce - should initialize only once |
nothing calls this directly
no outgoing calls
no test coverage detected