Commit 1ed0cf75 authored by Kevin Modzelewski's avatar Kevin Modzelewski

Add some more checking for this assert

parent bdd472d1
...@@ -81,8 +81,8 @@ else ...@@ -81,8 +81,8 @@ else
endif endif
TOOLS_DIR := ./tools TOOLS_DIR := ./tools
TEST_DIR := ./test TEST_DIR := $(abspath ./test)
TESTS_DIR := ./test/tests TESTS_DIR := $(abspath ./test/tests)
GPP := $(GCC_DIR)/bin/g++ GPP := $(GCC_DIR)/bin/g++
GCC := $(GCC_DIR)/bin/gcc GCC := $(GCC_DIR)/bin/gcc
......
...@@ -151,6 +151,9 @@ private: ...@@ -151,6 +151,9 @@ private:
struct Storage { struct Storage {
PerThreadSet<T, CtorArgs...>* self; PerThreadSet<T, CtorArgs...>* self;
#ifndef NDEBUG
pthread_t my_tid;
#endif
T val; T val;
}; };
...@@ -164,6 +167,8 @@ private: ...@@ -164,6 +167,8 @@ private:
auto* self = s->self; auto* self = s->self;
LOCK_REGION(&self->lock); LOCK_REGION(&self->lock);
assert(s->my_tid == pthread_self());
// I assume this destructor gets called on the same thread // I assume this destructor gets called on the same thread
// that this data is bound to: // that this data is bound to:
assert(self->map.count(pthread_self())); assert(self->map.count(pthread_self()));
...@@ -173,7 +178,11 @@ private: ...@@ -173,7 +178,11 @@ private:
} }
template <int... S> Storage* make(impl::seq<S...>) { template <int... S> Storage* make(impl::seq<S...>) {
return new Storage{.self = this, .val = T(std::get<S>(ctor_args)...) }; return new Storage{.self = this,
#ifndef NDEBUG
.my_tid = pthread_self(),
#endif
.val = T(std::get<S>(ctor_args)...) };
} }
public: public:
......
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