1

add possibility to ask thread to suicide itself

This commit is contained in:
2022-07-22 21:38:56 +02:00
parent 16d7ae071d
commit db476093c7
2 changed files with 35 additions and 0 deletions

View File

@ -90,6 +90,13 @@ public:
void kill(unsigned int tid, bse::unique_ptr<Thread>* ptr);
void kill(unsigned int tid) { kill(tid, nullptr); }
// Ask thread to exit
// NOTE: I had many problems with killing threads that were stuck in some semaphore
// or were involved in any locking mechanisms, so with this a thread can make sure
// to "set things right" before exiting itself (but could also be ignored)
void nice_kill(unsigned int tid, bse::unique_ptr<Thread>* ptr);
void nice_kill(unsigned int tid) { nice_kill(tid, nullptr); }
// CPU freiwillig abgeben und Auswahl des naechsten Threads
void yield();