Skip to content

Commit e5815ce

Browse files
committed
Change to struct
1 parent c92bd10 commit e5815ce

1 file changed

Lines changed: 10 additions & 11 deletions

File tree

python/pyarrow/src/arrow/python/helpers.cc

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -300,38 +300,37 @@ namespace {
300300
// Uses std::call_once when the GIL is disabled, or a simple boolean flag when
301301
// the GIL is enabled to avoid deadlocks. See ARROW-10519 for more details and
302302
// https://github.com/apache/arrow/commit/f69061935e92e36e25bb891177ca8bc4f463b272
303-
class ModuleOnceRunner {
304-
std::string module_name_;
303+
struct ModuleOnceRunner {
304+
std::string module_name;
305305
#ifdef Py_GIL_DISABLED
306-
std::once_flag initialized_;
306+
std::once_flag initialized;
307307
#else
308-
bool initialized_ = false;
308+
bool initialized = false;
309309
#endif
310310

311-
public:
312-
explicit ModuleOnceRunner(const std::string& module_name) : module_name_(module_name) {}
311+
explicit ModuleOnceRunner(const std::string& module_name) : module_name(module_name) {}
313312

314313
template <typename Func>
315314
void RunOnce(Func&& func) {
316315
auto do_init = [&]() {
317316
OwnedRef module;
318-
if (ImportModule(module_name_, &module).ok()) {
317+
if (ImportModule(module_name, &module).ok()) {
319318
#ifndef Py_GIL_DISABLED
320319
// Since ImportModule can release the GIL, another thread could have
321320
// already initialized the static data.
322-
if (initialized_) {
321+
if (initialized) {
323322
return;
324323
}
325324
#endif
326325
func(module);
327326
}
328327
};
329328
#ifdef Py_GIL_DISABLED
330-
std::call_once(initialized_, do_init);
329+
std::call_once(initialized, do_init);
331330
#else
332-
if (!initialized_) {
331+
if (!initialized) {
333332
do_init();
334-
initialized_ = true;
333+
initialized = true;
335334
}
336335
#endif
337336
}

0 commit comments

Comments
 (0)