Ralith / hecs

A handy ECS
Apache License 2.0
921 stars 79 forks source link

Multithreading #340

Closed Olle-Lukowski closed 9 months ago

Olle-Lukowski commented 9 months ago

I was wondering, is multithreading support planned? I really really like the api for this library, and it would be the perfect library for my project if multithreading was a thing

adamreichold commented 9 months ago

hecs is thread-safe, i.e. you can dispatch your systems into a thread pool but the thread pool itself is not part of hecs. The iter_batched interface is particularly suited to produce reasonably sized tasks to amortize dispatch overhead.

Of course, you need to ensure (statically or dynamically) that the borrows of your systems do not conflict. hecs will prevent conflicting borrows of the components but it will not block threads to resolve them.

Ralith commented 9 months ago

Closing as this question seems to be answered.