0

I have a qt application with a few boost threads running. When I get an unhandled exception (ex. std::runtime_error) in one of my qt event handlers, the boost threads also catch thread_interrupted exceptions.

Why does this happen? I already have try catch blocks around all of the interruption points, like boost sleep, so I can't figure out where the thread_interrupted exception comes from (the exception is caught in the thread function even though all the calls documented as interruption points are already wrapped in try-catch blocks).

Does the runtime or qt somehow terminate the boost threads and cause the thread_interrupted exception?

Ideally, I would like any unhandled exception in qt to present in the main thread and not in the boost threads.

Arno Duvenhage
  • 1,910
  • 17
  • 36

1 Answers1

0

Solved. I found an unprotected wait on a barrier. When an exception occurs in a Qt slot Qt starts cleaning up and the application destructor is called. This in turn caused my threads to be interrupted and those threads waiting on barriers then threw exceptions.

Arno Duvenhage
  • 1,910
  • 17
  • 36