MCPcopy Create free account
hub / github.com/TinyMPC/TinyMPC / ~ThreadLocal

Method ~ThreadLocal

include/Eigen/Eigen/src/ThreadPool/ThreadLocal.h:235–252  ·  view source on GitHub ↗

WARN: It's not thread safe to call it concurrently with `local()`.

Source from the content-addressed store, hash-verified

233
234 // WARN: It's not thread safe to call it concurrently with `local()`.
235 ~ThreadLocal() {
236 // Reading directly from `data_` is unsafe, because only CAS to the record
237 // in `ptr_` makes all changes visible to other threads.
238 for (auto& ptr : ptr_) {
239 ThreadIdAndValue* record = ptr.load();
240 if (record == nullptr) continue;
241 release_(record->value);
242 }
243
244 // We did not spill into the map based storage.
245 if (filled_records_.load(std::memory_order_relaxed) < capacity_) return;
246
247 // Adds a happens before edge from the last call to SpilledLocal().
248 EIGEN_MUTEX_LOCK lock(mu_);
249 for (auto& kv : per_thread_map_) {
250 release_(kv.second);
251 }
252 }
253
254 private:
255 struct ThreadIdAndValue {

Callers

nothing calls this directly

Calls 1

loadMethod · 0.45

Tested by

no test coverage detected