Page 1 of 1

[BUG] RCF::detail::thread.join() - not actual completion!

Posted: Mon Oct 21, 2013 7:44 am
by acDev
from Asio

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);   // <===
  }
}
RCF::detail::thread.join()

Code: Select all

void win_thread::join()
{
  HANDLE handles[2] = { exit_event_, thread_ };
  ::WaitForMultipleObjects(2, handles, FALSE, INFINITE);
  ::CloseHandle(exit_event_);
}
Correct version

Code: Select all

void win_thread::join()
{
  HANDLE handles[2] = { exit_event_, thread_ };
  ::WaitForMultipleObjects(2, handles, FALSE, INFINITE);
  ::CloseHandle(exit_event_);
  ::WaitForSingleObject(thread_, INFINITE);   // <===
}

Re: [BUG] RCF::detail::thread.join() - not actual completion

Posted: Mon Oct 21, 2013 10:32 am
by jarl
That's well spotted... I've fixed the code here, so the change will be in the next release. Thanks!