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/ap_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/ap_state.cpp')
-rw-r--r-- | src/ap_state.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/ap_state.cpp b/src/ap_state.cpp index 908c3a8..4ac0cce 100644 --- a/src/ap_state.cpp +++ b/src/ap_state.cpp | |||
@@ -675,7 +675,9 @@ bool AP_IsPaintingShuffle() { | |||
675 | return GetState().painting_shuffle; | 675 | return GetState().painting_shuffle; |
676 | } | 676 | } |
677 | 677 | ||
678 | const std::map<std::string, std::string>& AP_GetPaintingMapping() { | 678 | std::map<std::string, std::string> AP_GetPaintingMapping() { |
679 | std::lock_guard state_guard(GetState().state_mutex); | ||
680 | |||
679 | return GetState().painting_mapping; | 681 | return GetState().painting_mapping; |
680 | } | 682 | } |
681 | 683 | ||
@@ -685,7 +687,7 @@ bool AP_IsPaintingMappedTo(const std::string& painting_id) { | |||
685 | return GetState().painting_codomain.count(painting_id); | 687 | return GetState().painting_codomain.count(painting_id); |
686 | } | 688 | } |
687 | 689 | ||
688 | const std::set<std::string>& AP_GetCheckedPaintings() { | 690 | std::set<std::string> AP_GetCheckedPaintings() { |
689 | return GetState().GetCheckedPaintings(); | 691 | return GetState().GetCheckedPaintings(); |
690 | } | 692 | } |
691 | 693 | ||
@@ -778,7 +780,7 @@ bool AP_IsSunwarpShuffle() { | |||
778 | return GetState().sunwarp_shuffle; | 780 | return GetState().sunwarp_shuffle; |
779 | } | 781 | } |
780 | 782 | ||
781 | const std::map<int, SunwarpMapping>& AP_GetSunwarpMapping() { | 783 | std::map<int, SunwarpMapping> AP_GetSunwarpMapping() { |
782 | return GetState().sunwarp_mapping; | 784 | return GetState().sunwarp_mapping; |
783 | } | 785 | } |
784 | 786 | ||