Beispiel #1
0
void do_some_work ()
{
    while (1) {
        /* Do some useful things here...  */

        if (should_exit_thread_immediately ()) 
            throw ThreadExitException (/* thread's return value = */ NULL);
    }
}
void doSomeWork(const unsigned int threadNb, int& retVal){
    //thread number used then by the destructor message
    TestObj test(threadNb);
    std::cout<<std::endl;
    sleep(2.5L);
    //triggering pthread_exit
    //expected return value is passed as an exception constructor argument
    throw ThreadExitException(&retVal);
}