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

RCF support and general discussion.
Post Reply
acDev
Posts: 27
Joined: Tue Oct 08, 2013 3:08 pm
Location: Moscow
Contact:

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

Post 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);   // <===
}

jarl
Posts: 238
Joined: Mon Oct 03, 2011 4:53 am
Contact:

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

Post by jarl »

That's well spotted... I've fixed the code here, so the change will be in the next release. Thanks!
Kind Regards

Jarl Lindrud
Delta V Software
http://www.deltavsoft.com

Post Reply