Boost thread interrupt causes crash on Windows

3

The code below causes a crash running on Windows 7. I've tried MSVC2013 x64 and MSVC2012 x86 compilers via Qt Creator. Both cause the issue.

The crash occurs when boost::thread::interrupt() is called. Giving the error message:

#include <iostream>
#include <boost/thread.hpp>

// A function that will run until interrupted
void test_function()
{
  try
  {
    while(true)
    {
      boost::this_thread::interruption_point();
    }
  }
  catch(...)
  {
  }
}

// Should start a thread, wait for a second and then interupt the thread
int main()
{
  boost::thread thread(&test_function);
  boost::this_thread::sleep_for(boost::chrono::seconds(1));

  thread.interrupt();
  thread.join();

  return 0;
}

The boost version is 1.55 and has been compiled on my machine with both compilers mentioned above.

The error message reported is: Exception at 0x7fefd44940d, code: 0xe06d7363: C++ exception, flags=0x1 (execution cannot be continued) (first chance) at c:\boost\boost_1_55_0\libs\thread\src\win32\thread.cpp:604

I cannot get a stack trace, presumably as it is a call to std::terminate rather than a segfault.

c++
multithreading
boost
asked on Stack Overflow Oct 17, 2014 by SvaLopLop

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0