try run this code
-----------------------------------------
#include <zthread/Thread.h>
#include <iostream>
#include <stdexcept>
using namespace ZThread;
class aRunnable : public Runnable {
void run() {
Thread::sleep(3000);
try
{
throw (std::runtime_error("new exception")); //core dumped, run terminate() (gcc 3.4.6)
}
catch(...)
{
std::cout << "never " << std::endl; //!! this line is never being executed!!!!
}
std::cout << "Hello from another thread" << std::endl;
}
};
int main() {
// Explictly constructs a Task
Task task(new aRunnable);
Thread t1(task,0);
std::cout << "Hello from the main thread" << std::endl;
try run this code
-----------------------------------------
#include <zthread/Thread.h>
#include <iostream>
#include <stdexcept>
using namespace ZThread;
class aRunnable : public Runnable {
void run() {
Thread::sleep(3000);
try
{
throw (std::runtime_error("new exception")); //core dumped, run terminate() (gcc 3.4.6)
}
catch(...)
{
std::cout << "never " << std::endl; //!! this line is never being executed!!!!
}
std::cout << "Hello from another thread" << std::endl;
}
};
int main() {
// Explictly constructs a Task
Task task(new aRunnable);
Thread t1(task,0);
std::cout << "Hello from the main thread" << std::endl;
return 0;
}
---------------------------------------------
Why?