| 241 | static std::atomic<int>* g_deinit_count = nullptr; |
| 242 | |
| 243 | static int InitWithCounter(void** handle_addr) { |
| 244 | auto* counter = new ThreadSafeCounter(42, g_init_count, g_deinit_count); |
| 245 | if (counter->init_count_ptr) { |
| 246 | counter->init_count_ptr->fetch_add(1, std::memory_order_relaxed); |
| 247 | } |
| 248 | // Small delay to increase the race window |
| 249 | std::this_thread::sleep_for(std::chrono::microseconds(100)); |
| 250 | *handle_addr = counter; |
| 251 | return 0; |
| 252 | } |
| 253 | |
| 254 | static int DeinitWithCounter(void* h) { |
| 255 | auto* counter = static_cast<ThreadSafeCounter*>(h); |
nothing calls this directly
no outgoing calls
no test coverage detected