| 138 | } |
| 139 | |
| 140 | std::vector<StringView> Blackboard::getKeys() const |
| 141 | { |
| 142 | // Lock storage_mutex_ (shared) to prevent iterator invalidation and |
| 143 | // dangling StringView from concurrent modifications (BUG-6 fix). |
| 144 | const std::shared_lock storage_lock(storage_mutex_); |
| 145 | if(storage_.empty()) |
| 146 | { |
| 147 | return {}; |
| 148 | } |
| 149 | std::vector<StringView> out; |
| 150 | out.reserve(storage_.size()); |
| 151 | for(const auto& entry_it : storage_) |
| 152 | { |
| 153 | out.push_back(entry_it.first); |
| 154 | } |
| 155 | return out; |
| 156 | } |
| 157 | |
| 158 | void Blackboard::clear() |
| 159 | { |