Is the Visual C++ implementation of std::async using a thread pool legal

后端 未结 1 1074
臣服心动
臣服心动 2021-02-05 03:28

Visual C++ uses the Windows thread pool (Vista\'s CreateThreadpoolWork if available and QueueUserWorkItem if not) when calling std::async

1条回答
  •  粉色の甜心
    2021-02-05 04:04

    The situation has been clarified somewhat in C++17 by P0296R2. Unless the Visual C++ implementation documents that its threads do not provide concurrent forward progress guarantees (which would be generally undesirable), the bounded thread pool is not conforming (in C++17).

    The note about "externally imposed thread priorities" has been removed, perhaps because it is already always possible for the environment to prevent the progress of a C++ program (if not by priority, then by being suspended, and if not that, then by power or hardware failure).

    There is one remaining normative "should" in that section, but it pertains (as conio mentioned) only to lock-free operations, which can be delayed indefinitely by frequent concurrent access by other thread to the same cache line (not merely the same atomic variable). (I think that in some implementations this can happen even if the other threads are only reading.)

    0 讨论(0)
提交回复
热议问题