Detached sampling thread must start/stop in atomic
rocmwrapper has rsmiSamplingRunning as bool which should be atomic. The same goes for the nvmlwrapper, but moreover it calls detach, not join, which is not appropriate. Any wrappers using a thread to sample must use a condition variable atomic and call join on the closing sequence.
Edited  by Ondrej Vysocky
