A year and a bit ago, I wrote about adding a test suite to Omniscient. In that post, I mentioned:

This line of thought also lead me to discover that WaitForMultipleObjects only supports up to 64 objects - fortunately using WaitForSingleObject in a for loop gets around this limit.

Today, Raymond Chen – a long-serving Microsoft employee known for his very quality blog The Old New Thing – has written about that same problem, in his post “What if I need to wait for more than MAXIMUM_WAIT_OBJECTS threads?”. Not just that, he concludes with the same solution I came to:

So yes, you can wait for them in blocks of MAXIMUM_WAIT_OBJECTS. But really, even that is too much work. You can just wait for them one at a time.

for (auto&& handle : m_threadHandles)
{
    REQUIRE(WaitForSingleObject(handle, INFINITE)
            == WAIT_OBJECT_0);
}

To be fair, the problem is probably somewhat common, and the solution incredibly obvious. But it’s weird because the tables have turned: before I’ve solved things thanks to his blog, but today he writes about something I’ve already solved myself.