0

I am facing a situation like this ...
The main thread has some object "result" and it passed as a reference to a new thread 'T' now main thread in destructing result object and thread 'T' is trying to use that result object after its destruction by the Main thread. (Given that T is detached)
I want to kill the thread T when result object is destroyed.

suryansh
  • 11
  • 6
  • 5
    Possible duplicate of [How to terminate or stop a detached thread in c++?](https://stackoverflow.com/questions/25655706/how-to-terminate-or-stop-a-detached-thread-in-c) – Lucas Hendren Apr 17 '19 at 03:46
  • Is there any way to solve my problem, I basically want to use the resource shared by the Main thread in Child thread and also detach the thread. Currently, Main Thread is destructed and after its destruction Child is trying to access its resource so I am getting exception. – suryansh Apr 17 '19 at 07:29

0 Answers0