diff options
author | Star Rauchenberger <fefferburbia@gmail.com> | 2024-12-20 14:33:43 -0500 |
---|---|---|
committer | Star Rauchenberger <fefferburbia@gmail.com> | 2024-12-20 14:33:43 -0500 |
commit | 3c49081df34fb1801063c0b538d12d4422fcf3f0 (patch) | |
tree | f4d267d953c97b0ee3e78730d8e36484abf7f096 /src/ipc_state.cpp | |
parent | 5a7559e39d2cd8306a99adbc6d39e90716b14687 (diff) | |
download | lingo-ap-tracker-3c49081df34fb1801063c0b538d12d4422fcf3f0.tar.gz lingo-ap-tracker-3c49081df34fb1801063c0b538d12d4422fcf3f0.tar.bz2 lingo-ap-tracker-3c49081df34fb1801063c0b538d12d4422fcf3f0.zip |
Fixed remaining thread unsafe APState/IPCState reads
Still would like to add some kind of wrapper object that TrackerState could use to read APState without locking, since it'll only ever be called from the thread that would do the mutating, but this is fine for now.
Diffstat (limited to 'src/ipc_state.cpp')
-rw-r--r-- | src/ipc_state.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/ipc_state.cpp b/src/ipc_state.cpp index cba576c..1f8d286 100644 --- a/src/ipc_state.cpp +++ b/src/ipc_state.cpp | |||
@@ -103,7 +103,7 @@ struct IPCState { | |||
103 | return player_position; | 103 | return player_position; |
104 | } | 104 | } |
105 | 105 | ||
106 | const std::set<std::string>& GetSolvedPanels() { | 106 | std::set<std::string> GetSolvedPanels() { |
107 | std::lock_guard state_guard(state_mutex); | 107 | std::lock_guard state_guard(state_mutex); |
108 | 108 | ||
109 | return solved_panels; | 109 | return solved_panels; |
@@ -383,6 +383,6 @@ std::optional<std::tuple<int, int>> IPC_GetPlayerPosition() { | |||
383 | return GetState().GetPlayerPosition(); | 383 | return GetState().GetPlayerPosition(); |
384 | } | 384 | } |
385 | 385 | ||
386 | const std::set<std::string>& IPC_GetSolvedPanels() { | 386 | std::set<std::string> IPC_GetSolvedPanels() { |
387 | return GetState().GetSolvedPanels(); | 387 | return GetState().GetSolvedPanels(); |
388 | } | 388 | } |