You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@arrow.apache.org by "Kouhei Sutou (Jira)" <ji...@apache.org> on 2019/12/24 02:49:00 UTC

[jira] [Updated] (ARROW-7464) [C++] Refine CpuInfo singleton with std::call_once

     [ https://issues.apache.org/jira/browse/ARROW-7464?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Kouhei Sutou updated ARROW-7464:
--------------------------------
    Summary: [C++] Refine CpuInfo singleton with std::call_once  (was: [C++][util]: Refine CpuInfo singleton with std::call_once)

> [C++] Refine CpuInfo singleton with std::call_once
> --------------------------------------------------
>
>                 Key: ARROW-7464
>                 URL: https://issues.apache.org/jira/browse/ARROW-7464
>             Project: Apache Arrow
>          Issue Type: Improvement
>          Components: C++
>            Reporter: Yibo Cai
>            Assignee: Yibo Cai
>            Priority: Minor
>              Labels: pull-request-available
>          Time Spent: 40m
>  Remaining Estimate: 0h
>
> CpuInfo singleton is created and initialized on first invocation of
> [CpuInfo::GetInstance()|https://github.com/apache/arrow/blob/master/cpp/src/arrow/util/cpu_info.cc#L188-L195]. All calls afterwards return reference to the
> same instance. Current code uses std::mutex to make sure that CpuInfo
> is created only once, but it introduces unnecessary overhead for later
> calls. Concurrent threads getting the created instance should not block
> each other.
> Replace std::mutex with std::call_once to fix this issue.
> References:
> [1] https://en.cppreference.com/w/cpp/thread/call_once
> [2] http://www.modernescpp.com/index.php/thread-safe-initialization-of-data



--
This message was sent by Atlassian Jira
(v8.3.4#803005)