I am trying to learn std::threads
from C++11
to make a threading system.
I was wondering if there is a way to stop a thread from running (Not sleeping, but really destructing the thread or so to speak) without terminating the whole program.
I know std::join
exists, but that forces a thread to wait till all threads return.
Is there another way to handle this? (For example for making a ThreadPool
class without having to block a thread?)
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…