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.
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.
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.