You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the problem you are trying to solve.
Pinning systems to threads is important to keep specific library calls on the main thread, prevent splitting of a module's systems across threads and to allow thread-safe systems to run on any thread at the same time.
Describe the solution you'd like
* Updated *
Introduce the concept of a main flecs thread which is the ecs_progress() thread / thread index 0 as far as flecs is concerned.
For backward compatibility existing systems should run on the main thread unless specified otherwise
With the exception of the main thread, thread pinning should be always to be to a pseudo-thread, the flecs thread index could change at any time as long as the pinned systems don't run on different threads, this only has to be a specification at first.
For systems that are threadsafe there should be an easy way to mark them as such
// Always run on thread idx 0 by defaultECS_SYSTEM("Move", "Position, Velocity");
//Mark system as thread-safe, alternative names: MultiThread, AllThreads, AnyThreadECS_SYSTEM("X", "SYSTEM:ThreadSafe Lorem, Ipsum");
//Creates an entityECS_THREAD(MotionThread);
//"Thread" is a builtin trait, makes it more obvious `MotionThread` is a thread//System is not split across threads, but the thread index may changeECS_SYSTEM("Move", "SYSTEM:Thread FOR MotionThread, Position, Velocity");
//Also not split across threads and on the same thread as MoveECS_SYSTEM("X", "SYSTEM:Thread FOR MotionThread Lorem, Ipsum");
//Alternative syntaxECS_SYSTEM("Move", "THREAD:MotionThread Position, Velocity");
Why something like THREAD:0-N would be a bad idea:
Modules from different sources could hog the same thread and assumes flecs will spawn N threads, named threads are also better for debugging.
The text was updated successfully, but these errors were encountered:
Have some question about threading. Can i create custom pipeline with some stages marked as single threaded? I need 2 stages what runs on main thread and 5 stages what multi threaded.
Describe the problem you are trying to solve.
Pinning systems to threads is important to keep specific library calls on the main thread, prevent splitting of a module's systems across threads and to allow thread-safe systems to run on any thread at the same time.
Describe the solution you'd like
* Updated *
Introduce the concept of a main flecs thread which is the
ecs_progress()
thread / thread index 0 as far as flecs is concerned.For backward compatibility existing systems should run on the main thread unless specified otherwise
With the exception of the main thread, thread pinning should be always to be to a pseudo-thread, the flecs thread index could change at any time as long as the pinned systems don't run on different threads, this only has to be a specification at first.
For systems that are threadsafe there should be an easy way to mark them as such
Why something like
THREAD:0-N
would be a bad idea:Modules from different sources could hog the same thread and assumes flecs will spawn N threads, named threads are also better for debugging.
The text was updated successfully, but these errors were encountered: