MCPcopy Create free account
hub / github.com/apache/arrow / RunOnce

Method RunOnce

python/pyarrow/src/arrow/python/helpers.cc:313–335  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

311
312 template <typename Func>
313 void RunOnce(Func&& func) {
314 auto do_init = [&]() {
315 OwnedRef module;
316 if (ImportModule(module_name, &module).ok()) {
317#ifndef Py_GIL_DISABLED
318 // Since ImportModule can release the GIL, another thread could have
319 // already initialized the static data.
320 if (initialized) {
321 return;
322 }
323#endif
324 func(module);
325 }
326 };
327#ifdef Py_GIL_DISABLED
328 std::call_once(initialized, do_init);
329#else
330 if (!initialized) {
331 do_init();
332 initialized = true;
333 }
334#endif
335 }
336};
337
338static PyObject* uuid_UUID = nullptr;

Callers 2

IsPyUuidFunction · 0.80
InitPandasStaticDataFunction · 0.80

Calls 3

ImportModuleFunction · 0.85
funcFunction · 0.50
okMethod · 0.45

Tested by

no test coverage detected