Click here to Skip to main content
15,889,200 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hey guys,
I had a question about Concurrency::tasks. What happens if I have created a concurrency task and the task is in flight (i.e. not done yet) and the application gracefully terminates.

Is the cancellation of the task internally handled somewhere or do I need to explicitly cancel the task by hand?

I ask as I am trying to debug an issue which is not easily reproducible, I am getting an exception upon exit

C#
~_ExceptionHolder()
{
    if (_M_exceptionObserved == 0)
    {
        // If you are trapped here, it means an exception thrown in task chain didn't get handled.
        // Please add task-based continuation to handle all exceptions coming from tasks.
        // this->_M_stackTrace keeps the creation callstack of the task generates this exception.
        _REPORT_PPLTASK_UNOBSERVED_EXCEPTION();
    }
}


from ppltasks.h. I wonder if this is happening because my task is already in flight? Help would be appreciated. Thanks.
Posted
Comments
Sergey Alexandrovich Kryukov 13-Jun-15 20:44pm    
What are you asking about? PPL and concurrency::task have nothing to do with CLI.
—SA
Mehdi Gholam 14-Jun-15 2:42am    
On termination of the app (via a wanted shutdown) the system will wait for tasks to finish (up to a timeout ~2seconds) otherwise it will act like an unwanted termination and kill all tasks regardless of finishing.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900