Opened 4 years ago

Closed 3 years ago

#10788 closed Bugs (fixed)

GetLogicalProcessor isn't available for Windows platform less or equals to 0x0502

Reported by: steve.tousignant@… Owned by: viboes
Milestone: Boost 1.60.0 Component: thread
Version: Boost 1.57.0 Severity: Problem
Keywords: Cc:


I've runned into an issue while using boost 1.56.0 and boost 1.57.0 while ours software was deployed on a Windows XP SP2. When using the threading library from boost, we have found out that it was using a feature only available on Windows XP SP3 and higher.

The effect are that the software built with Boost 1.56.0 and boost 1.57.0 refuse to start even after we force the feature set of windows XP to be used by the Windows Platform SDK.

I will attach a patch as a proposed fix for future version of boost.

Attachments (1)

boost-1.57.0-WinXP-SP2-PhysicalConcurrency-Return0.patch (767 bytes) - added by steve.tousignant@… 4 years ago.
Proposed patch for boost threading

Download all attachments as: .zip

Change History (9)

Changed 4 years ago by steve.tousignant@…

Proposed patch for boost threading

comment:1 Changed 3 years ago by viboes

Component: threadsthread

Please, don't use the threads component but the thread one.

Last edited 3 years ago by viboes (previous) (diff)

comment:2 Changed 3 years ago by viboes

Owner: changed from Anthony Williams to viboes
Status: newassigned

The current code is

    unsigned thread::physical_concurrency() BOOST_NOEXCEPT
#if BOOST_PLAT_WINDOWS_RUNTIME || (defined(__MINGW32__) && !defined(__MINGW64_VERSION_MAJOR))
        return hardware_concurrency();
        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)
        return cores;

Does it works for you?

comment:3 Changed 3 years ago by viboes

PING !!!

comment:4 Changed 3 years ago by viboes

Type: BugsSupport Requests

comment:5 Changed 3 years ago by viboes

Type: Support RequestsBugs

comment:6 Changed 3 years ago by viboes

Milestone: To Be DeterminedBoost 1.60.0

#11683 describes the history of this function and how we rolled back a fix.

I've update the develop branch.

comment:7 Changed 3 years ago by Daniel

Please also take into account the issue with comments after preprocessor continuation for VS2010 (comment:6:ticket:10824): commit/8e1be55c6d560c44fb07cc497a3480527957576c

comment:8 Changed 3 years ago by viboes

Resolution: fixed
Status: assignedclosed
Note: See TracTickets for help on using tickets.