Re: [Boost-bugs] [Boost C++ Libraries] #10788: GetLogicalProcessor isn't available for Windows platform less or equals to 0x0502

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #10788: GetLogicalProcessor isn't available for Windows platform less or equals to 0x0502
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2015-06-28 09:07:10


#10788: GetLogicalProcessor isn't available for Windows platform less or equals to
0x0502
---------------------------------+----------------------
  Reporter: steve.tousignant@… | Owner: viboes
      Type: Bugs | Status: assigned
 Milestone: To Be Determined | Component: thread
   Version: Boost 1.57.0 | Severity: Problem
Resolution: | Keywords:
---------------------------------+----------------------
Changes (by viboes):

 * owner: anthonyw => viboes
 * status: new => assigned

Comment:

 The current code is


 {{{
     unsigned thread::physical_concurrency() BOOST_NOEXCEPT
     {
 #if BOOST_PLAT_WINDOWS_RUNTIME || (defined(__MINGW32__) &&
 !defined(__MINGW64_VERSION_MAJOR))
         return hardware_concurrency();
 #else
         unsigned cores = 0;
         DWORD size = 0;

         GetLogicalProcessorInformation(NULL, &size);
         if (ERROR_INSUFFICIENT_BUFFER != GetLastError())
             return 0;

         std::vector<SYSTEM_LOGICAL_PROCESSOR_INFORMATION> buffer(size);
         if (GetLogicalProcessorInformation(&buffer.front(), &size) ==
 FALSE)
             return 0;

         const size_t Elements = size /
 sizeof(SYSTEM_LOGICAL_PROCESSOR_INFORMATION);

         for (size_t i = 0; i < Elements; ++i) {
             if (buffer[i].Relationship == RelationProcessorCore)
                 ++cores;
         }
         return cores;
 #endif
     }
 }}}

 Does it works for you?

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/10788#comment:2>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:18 UTC