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

Method RunOnce

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

Source from the content-addressed store, hash-verified

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

Callers 2

GetUuidClassFunction · 0.80
InitPandasStaticDataFunction · 0.80

Calls 3

ImportModuleFunction · 0.85
funcFunction · 0.50
okMethod · 0.45

Tested by

no test coverage detected