How to kill a detached thread

Hi,

I am hardware verification engineer and we are using C++ for our Verification env.
I am facing an issue, where I am running a background thread (detached) for checking my test results.

I wanted to know if there is a way to terminate a detached threads. In my case when I am done with running checks for N frames, I want to terminate the background thread.

Any ideas or suggestions will be helpful

BR
OS?
Hardware?
Threading library?

From the C++ threading library POV, you can’t.
It may be possible using the underlying threading library / OS capabilities, but that requires you to know them.

This very question has been asked before:
https://stackoverflow.com/questions/25655706/how-to-terminate-or-stop-a-detached-thread-in-c

Sorry there isn’t a better answer than: that’s not how it’s meant to work. For your particular case you may wish to have a shared flag / counter / something that the thread itself can check and terminate itself when appropriate.

Good luck!
sometimes, its OK to just kill stuff via the OS rather than fuss over it.
Topic archived. No new replies allowed.