Commit ceed3536 authored by Kevin Modzelewski's avatar Kevin Modzelewski

Add even more threading asserts

parent 9407f64a
...@@ -192,8 +192,8 @@ private: ...@@ -192,8 +192,8 @@ private:
LOCK_REGION(&self->lock); LOCK_REGION(&self->lock);
ASSERT(self->map.size() == self->map_elts, "%ld %d", self->map.size(), self->map_elts);
assert(s->my_tid == pthread_self()); assert(s->my_tid == pthread_self());
ASSERT(self->map.size() == self->map_elts, "%ld %d", self->map.size(), self->map_elts);
assert(self->map.count(pthread_self())); assert(self->map.count(pthread_self()));
self->map.erase(pthread_self()); self->map.erase(pthread_self());
...@@ -202,6 +202,8 @@ private: ...@@ -202,6 +202,8 @@ private:
#endif #endif
delete s; delete s;
ASSERT(self->map.size() == self->map_elts, "%ld %d", self->map.size(), self->map_elts);
} }
template <int... S> Storage* make(impl::seq<S...>) { template <int... S> Storage* make(impl::seq<S...>) {
...@@ -214,6 +216,7 @@ private: ...@@ -214,6 +216,7 @@ private:
protected: protected:
void onFork() override { void onFork() override {
ASSERT(this->map.size() == this->map_elts, "%ld %d", this->map.size(), this->map_elts);
pthread_t surviving_ptid = pthread_self(); pthread_t surviving_ptid = pthread_self();
for (auto it = this->map.begin(), end = this->map.end(); it != end;) { for (auto it = this->map.begin(), end = this->map.end(); it != end;) {
if (it->first != surviving_ptid) { if (it->first != surviving_ptid) {
...@@ -241,6 +244,8 @@ public: ...@@ -241,6 +244,8 @@ public:
for (auto& p : map) { for (auto& p : map) {
f(&p.second->val); f(&p.second->val);
} }
ASSERT(this->map.size() == this->map_elts, "%ld %d", this->map.size(), this->map_elts);
} }
template <typename... Arguments> void forEachValue(std::function<void(T*, Arguments...)> f, Arguments... args) { template <typename... Arguments> void forEachValue(std::function<void(T*, Arguments...)> f, Arguments... args) {
...@@ -250,6 +255,8 @@ public: ...@@ -250,6 +255,8 @@ public:
for (auto& p : map) { for (auto& p : map) {
f(&p.second->val, std::forward<Arguments>(args)...); f(&p.second->val, std::forward<Arguments>(args)...);
} }
ASSERT(this->map.size() == this->map_elts, "%ld %d", this->map.size(), this->map_elts);
} }
T* get() { T* get() {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment