diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2017-06-18 18:19:17 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2017-06-18 18:48:42 +0200 |
commit | e88c7b29ea9ec9fcd6ac6b15c965085152100d2e (patch) | |
tree | 6747fe7fa797e024b986ba624d05e6f59032f0ac /logic/tracker.cpp | |
parent | 646530b5f9ca5debe7a9b4840192e32e43f919bf (diff) |
get rid of "volatile" abuse
We heavily used "volatile bool" to check if the thread
loop should stop. But this functionality is already
provided by Qt5's QThread::requestInterruption.
In other cases, "volatile" is wonderfully
underspecified so it's better to ditch its usage in
favor of std::atomic<t>. At the time we don't appear to
be using the "volatile" keyword except when calling
win32's Interlocked*() family of functions as
necessary.
In freetrackclient's header the "volatile" qualifier
was used as part of a typedef. This doesn't work. Use
it as part of data declaration.
Diffstat (limited to 'logic/tracker.cpp')
-rw-r--r-- | logic/tracker.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/logic/tracker.cpp b/logic/tracker.cpp index a5d4b86f..533a6f54 100644 --- a/logic/tracker.cpp +++ b/logic/tracker.cpp @@ -44,7 +44,7 @@ Tracker::Tracker(Mappings& m, SelectedLibraries& libs, TrackLogger& logger) : Tracker::~Tracker() { - set(f_should_quit, true); + requestInterruption(); wait(); } @@ -384,7 +384,7 @@ void Tracker::run() t.start(); - while (!get(f_should_quit)) + while (!isInterruptionRequested()) { logic(); @@ -491,5 +491,4 @@ bits::bits() : b(0u) set(f_enabled_p, true); set(f_enabled_h, true); set(f_zero, false); - set(f_should_quit, false); } |