| 164 | static std::atomic<int>* g_deinit_count = nullptr; |
| 165 | |
| 166 | static int InitWithCounter(void** handle_addr) { |
| 167 | auto* counter = new ThreadSafeCounter(42, g_init_count, g_deinit_count); |
| 168 | if (counter->init_count_ptr) { |
| 169 | counter->init_count_ptr->fetch_add(1, std::memory_order_relaxed); |
| 170 | } |
| 171 | // Small delay to increase the race window |
| 172 | std::this_thread::sleep_for(std::chrono::microseconds(100)); |
| 173 | *handle_addr = counter; |
| 174 | return 0; |
| 175 | } |
| 176 | |
| 177 | static int DeinitWithCounter(void* h) { |
| 178 | auto* counter = static_cast<ThreadSafeCounter*>(h); |
nothing calls this directly
no outgoing calls
no test coverage detected