Skip to content

Commit a518a0b

Browse files
committed
Use SafeFlag instead of atomic
1 parent 06b5c75 commit a518a0b

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

modules/camera/camera_web.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,11 +151,11 @@ void CameraWeb::_on_get_cameras_callback(void *context, const Vector<CameraInfo>
151151
server->add_feed(feed);
152152
}
153153
server->CameraServer::set_monitoring_feeds(true);
154-
server->activating = false;
154+
server->activating.clear();
155155
}
156156

157157
void CameraWeb::_update_feeds() {
158-
activating = true;
158+
activating.set();
159159
camera_driver_web->get_cameras((void *)this, &_on_get_cameras_callback);
160160
}
161161

@@ -168,7 +168,7 @@ void CameraWeb::_cleanup() {
168168
}
169169

170170
void CameraWeb::set_monitoring_feeds(bool p_monitoring_feeds) {
171-
if (p_monitoring_feeds == monitoring_feeds || activating) {
171+
if (p_monitoring_feeds == monitoring_feeds || activating.is_set()) {
172172
return;
173173
}
174174

modules/camera/camera_web.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@
3434
#include "servers/camera/camera_feed.h"
3535
#include "servers/camera_server.h"
3636

37-
#include <atomic>
38-
3937
class CameraFeedWeb : public CameraFeed {
4038
GDSOFTCLASS(CameraFeedWeb, CameraFeed);
4139

@@ -63,7 +61,7 @@ class CameraWeb : public CameraServer {
6361

6462
private:
6563
CameraDriverWeb *camera_driver_web = nullptr;
66-
std::atomic<bool> activating;
64+
SafeFlag activating;
6765
void _cleanup();
6866
void _update_feeds();
6967
static void _on_get_cameras_callback(void *context, const Vector<CameraInfo> &camera_info);

0 commit comments

Comments
 (0)