[BUG] RCF::detail::thread.join() - not actual completion!
Posted: Mon Oct 21, 2013 7:44 am
from Asio
RCF::detail::thread.join()
Correct version
Code: Select all
void win_thread::join()
{
HANDLE handles[2] = { exit_event_, thread_ };
::WaitForMultipleObjects(2, handles, FALSE, INFINITE);
::CloseHandle(exit_event_);
if (terminate_threads())
{
::TerminateThread(thread_, 0);
}
else
{
::QueueUserAPC(apc_function, thread_, 0);
::WaitForSingleObject(thread_, INFINITE); // <===
}
}
Code: Select all
void win_thread::join()
{
HANDLE handles[2] = { exit_event_, thread_ };
::WaitForMultipleObjects(2, handles, FALSE, INFINITE);
::CloseHandle(exit_event_);
}
Code: Select all
void win_thread::join()
{
HANDLE handles[2] = { exit_event_, thread_ };
::WaitForMultipleObjects(2, handles, FALSE, INFINITE);
::CloseHandle(exit_event_);
::WaitForSingleObject(thread_, INFINITE); // <===
}