From 3eccd38e989012ff35ee5376670aabc338c52008 Mon Sep 17 00:00:00 2001 From: Clyne Sullivan Date: Sun, 12 Feb 2017 17:07:55 -0500 Subject: locked EM.each, arenas --- entityx/Entity.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'entityx/Entity.h') diff --git a/entityx/Entity.h b/entityx/Entity.h index 3217ae5..a423f8f 100644 --- a/entityx/Entity.h +++ b/entityx/Entity.h @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include @@ -462,8 +463,11 @@ class EntityManager : entityx::help::NonCopyable { template struct identity { typedef T type; }; void each(typename identity>::type f) { + static std::mutex locked; + locked.lock(); for (auto it : *this) f(it, *(it.template component().get())...); + locked.unlock(); } private: -- cgit v1.2.3