]> git.seodisparate.com - EntityComponentMetaSystem/commit
Fix possible data-race with isAlive() calls
authorStephen Seo <seo.disparate@gmail.com>
Thu, 20 Jan 2022 05:31:23 +0000 (14:31 +0900)
committerStephen Seo <seo.disparate@gmail.com>
Thu, 20 Jan 2022 05:31:23 +0000 (14:31 +0900)
commite61d2724e68a21f2855b9dabf917f9e48d42f5e4
tree94ef86802c3ec7d507b5c1633dac28aa92eab49e
parentf27c22675a28eae6d6b6be2a60c71b67c8a4a50a
Fix possible data-race with isAlive() calls

Removed isAlive() calls from functions passed to ThreadPool, and instead use an
unordered_set prior to using ThreadPool to "cache" which entities are not alive.
This is so that if a function passed to ThreadPool modifies the ECManager (e.g.
creating a new entity), then there will be no data race from also calling
isAlive(). (Note that this does not protect against "deleting" entities from the
ECManager during use of ThreadPool. It is expected for the caller to do the
"deleting" after use of stored/called functions is finished.)
src/EC/Manager.hpp