I have a simple c++ class - A which has some tasks in it.
concurrency::task<void> m_task1;
And I wanted to cancel the task in the destructor. But i can see the destructor is never executed. I am afraid this can create memory leak. Why the destructor is not executed?
class MyClass
{
public:
explicit MyClass(MyException func);
~MyClass();
void Start(int interval = 2000);
private:
concurrency::task<void> m_task;
concurrency::cancellation_token_source m_cancellationToken;
...
};
/// <summary>Destructor.</summary>
MyClass::~MyClass()
{
// I clean up here
}