MCPcopy Create free account
hub / github.com/apache/tvm-ffi / DeinitWithCounter

Function DeinitWithCounter

tests/cpp/test_init_once.cc:177–186  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

175}
176
177static 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
188TEST(CEnvAPI, TVMFFIHandleInitDeinitOnceMultithreaded) {
189 // Test 1: Multiple threads calling InitOnce - should initialize only once

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected