diff options
author | Aki <please@ignore.pl> | 2022-03-27 22:11:07 +0200 |
---|---|---|
committer | Aki <please@ignore.pl> | 2022-03-27 22:11:07 +0200 |
commit | 1cf689a6ad9d6c5cd29e11a6a96cb075eb2bbbb8 (patch) | |
tree | 3b31cdfcefe051a9a31972703b4d738812467abf /Stars45/RadioVox.cpp | |
parent | 2ba515370864b85bd29b0d23083248c74a868691 (diff) | |
download | starshatter-1cf689a6ad9d6c5cd29e11a6a96cb075eb2bbbb8.zip starshatter-1cf689a6ad9d6c5cd29e11a6a96cb075eb2bbbb8.tar.gz starshatter-1cf689a6ad9d6c5cd29e11a6a96cb075eb2bbbb8.tar.bz2 |
Replaced ThreadSync with stl's mutex
Diffstat (limited to 'Stars45/RadioVox.cpp')
-rw-r--r-- | Stars45/RadioVox.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/Stars45/RadioVox.cpp b/Stars45/RadioVox.cpp index 2131aae..8942caf 100644 --- a/Stars45/RadioVox.cpp +++ b/Stars45/RadioVox.cpp @@ -11,6 +11,8 @@ View class for Radio Communications HUD Overlay */ +#include <mutex> + #include "RadioVox.h" #include "RadioView.h" #include "AudioConfig.h" @@ -18,7 +20,6 @@ #include "DataLoader.h" #include "Game.h" #include "Sound.h" -#include "ThreadSync.h" // +====================================================================+ // @@ -42,7 +43,7 @@ public: bool shutdown; HANDLE hthread; List<RadioVox> queue; - ThreadSync sync; + std::mutex sync; }; static RadioVoxController* controller = 0; @@ -100,7 +101,7 @@ RadioVoxController::UpdateThread() void RadioVoxController::Update() { - AutoThreadSync a(sync); + const std::lock_guard<std::mutex> lock(sync); if (queue.size()) { RadioVox* vox = queue.first(); @@ -116,7 +117,7 @@ RadioVoxController::Add(RadioVox* vox) if (!vox || vox->sounds.isEmpty()) return false; - AutoThreadSync a(sync); + const std::lock_guard<std::mutex> lock(sync); if (queue.size() < MAX_QUEUE) { queue.append(vox); |