AfxBeginThread returns CWinThread*, and MFC assumes that it will handle the handle associated with the thread.
So, in order to use the descriptor safely, you need to duplicate it, otherwise, when the end of the MFC stream can close the descriptor before you go to the WaitForSingleObject call.
API- win32 CreateThread, .