TheadPoolJob shouldStop flag


#1

I think the ThreadJobPool::shouldStop flag is expected to be written/read by different threads. Should this be a std::atomic rather than a raw bool? If not why?


#2

The code may be counting on writes and reads to the bool being implicitly atomic on the used CPU architectures. However, a potential problem might be that the compiler may remove the operations on the variable in release builds. But I guess that isn’t happening in the current code since the Juce developers haven’t found it necessary to have the flag variable to be an atomic or a volatile?


#3

ok - more or less what i was guessing. much appreciated :slight_smile: