Acceleration of a stream upon interruption does not display an exit message

I have this part of the code for executing three threads, where the second thread should abort when you press enter and print an exit message:

void input_val()
{
    // DO STUFF
return;
}

void process_val()
{
       // DO STUFF
       try{
        cout << "waiting for ENTER..." << endl;
        boost::this_thread::sleep(boost::posix_time::milliseconds(200));
    }
    catch(boost::thread_interrupted&){
        cout << "exit process thread" << endl;
        return;
    }
    return;
}


void output_val()
{
    // DO STUFF
}

int main()
{
    char key_pressed;

    boost::thread input_thread(boost::bind(&input_val));
    boost::thread process_thread(boost::bind(&process_val));
    boost::thread output_thread(boost::bind(&output_val));

    cin.get(key_pressed);
    process_thread.interrupt();

    input_thread.join();
    process_thread.join();
    output_thread.join();
    return 0;
}

The thread_process aborts to "ENTER", but does not print a message indicating that it exited the termination process. Can anyone suggest what might be the problem, because I had a similar program yesterday. Thank you in advance!

+2
source share
1 answer

process_val, 200 , , 200 , try/catch . , , .

+2

All Articles