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

Function InitWithCounter

tests/cpp/extra/test_c_env_api.cc:243–252  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

241static std::atomic<int>* g_deinit_count = nullptr;
242
243static 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
254static int DeinitWithCounter(void* h) {
255 auto* counter = static_cast<ThreadSafeCounter*>(h);

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected