Add a comment about the shared_ptr<atomic>

This commit is contained in:
Henrik Rydgård committed 2026-09-02 17:53:12 +02:00
1 parent f0411ff6f4
commit 597e2bc6c0
1 file changed
+4
+4
View File
@@ -22,6 +22,10 @@ private:
struct Worker {
std::thread thread;
// Set by the worker as its last act, read by whoever calls Run() next.
// It does look a bit fragile with the atomic inside a shared_ptr, but the way
// this is used, it should be fine. The atomic is only used to signal that the thread
// is done, and the shared_ptr is only used to keep the atomic alive until
// the thread is joined.
std::shared_ptr<std::atomic<bool>> done;
};
std::vector<Worker> workers_;