Spotted by Joona.
No functional change.
// After releasing the lock we can't access any SplitPoint related data
// in a safe way because it could have been released under our feet by
// After releasing the lock we can't access any SplitPoint related data
// in a safe way because it could have been released under our feet by
- // the sp master. Also accessing other Thread objects is unsafe because
- // if we are exiting there is a chance that they are already freed.
sp->mutex.unlock();
// Try to late join to another split point if none of its slaves has
sp->mutex.unlock();
// Try to late join to another split point if none of its slaves has
-// exit() cleanly terminates the threads before the program exits
+// exit() cleanly terminates the threads before the program exits. Cannot be done in
+// d'tor because we have to terminate the threads before to free ThreadPool object.
void ThreadPool::exit() {
void ThreadPool::exit() {