diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2018-12-29 13:27:21 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2019-01-16 07:48:18 +0100 |
commit | e9bbb68829e972df2e458aa5beec0568d4737f02 (patch) | |
tree | b305103d53214dcddb76c1f26738d334972b17d3 /tracker-pt/ftnoir_tracker_pt.cpp | |
parent | a1a9a091093c9fb711a1665de9f4d46ae5c5ab67 (diff) |
compat/spinlock: implement and use it
Diffstat (limited to 'tracker-pt/ftnoir_tracker_pt.cpp')
-rw-r--r-- | tracker-pt/ftnoir_tracker_pt.cpp | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/tracker-pt/ftnoir_tracker_pt.cpp b/tracker-pt/ftnoir_tracker_pt.cpp index 7589242d..cee9c2a0 100644 --- a/tracker-pt/ftnoir_tracker_pt.cpp +++ b/tracker-pt/ftnoir_tracker_pt.cpp @@ -10,6 +10,7 @@ #include "cv/video-widget.hpp" #include "compat/camera-names.hpp" #include "compat/math-imports.hpp" +#include "compat/spinlock.hpp" #include "pt-api.hpp" @@ -65,8 +66,7 @@ void Tracker_PT::run() if (new_frame) { - while (center_flag.test_and_set()) - (void)0; + spinlock_guard l(center_flag); *preview_frame = *frame; @@ -112,8 +112,6 @@ void Tracker_PT::run() preview_frame = traits->make_preview(w, h); } } - - center_flag.clear(); } } } @@ -189,13 +187,9 @@ void Tracker_PT::data(double *data) bool Tracker_PT::center() { - while (center_flag.test_and_set()) - (void)0; + spinlock_guard l(center_flag); point_tracker.reset_state(); - - center_flag.clear(); - return false; } |