Om. Thanks very much. I look forward to your update.
Sadly, -O0 doesn't work for us, since we need the compiler optimizations
in the rest of our code, as it's a production system. Fortunately, we
were able to find an alternative workaround:
if we write a trivial c++ wrapper for the functions, without inline or
throw(), it seems icc decides it might generate an exception, and then
everything works properly.
@jimdempseyatthecove - Yes, that's already been tried, and no, it doesn't make a difference. The issue is with pthread_exit, and will occur even if handler_with_guard is not the thread entry point.