jeudi 26 mars 2015

C++11 substitute for `GetExitCodeThread` to monitor thread status?

I'm working on a large refactoring and port of a existing application that does some pretty spectacular(ly horrible) things with windows threads.


Right now, there is internal logic that calls GetExitCodeThread(m_threadHandle, &exitCode); on a set of running threads, and then checks if exitCode == STILL_ACTIVE to determine if the thread in question is still executing, or has returned, and then uses that to sequence some internal logic.


How can I check if a std::thread is still executing, or has returned/thrown an exception?


I know about std::async, std::promises and std::future. However, using those would involve considerable refactoring, and I don't feel I know the code-base well enough to make that scale of changes without breaking a dozen other things.


Aucun commentaire:

Enregistrer un commentaire