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

Function DeinitWithCounter

tests/cpp/extra/test_c_env_api.cc:254–263  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

252}
253
254static int DeinitWithCounter(void* h) {
255 auto* counter = static_cast<ThreadSafeCounter*>(h);
256 if (counter->deinit_count_ptr) {
257 counter->deinit_count_ptr->fetch_add(1, std::memory_order_relaxed);
258 }
259 // Small delay to increase the race window
260 std::this_thread::sleep_for(std::chrono::microseconds(100));
261 delete counter;
262 return 0;
263}
264
265TEST(CEnvAPI, TVMFFIHandleInitDeinitOnceMultithreaded) {
266 // 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