basiliscos / cpp-rotor

Event loop friendly C++ actor micro-framework, supervisable
MIT License
344 stars 33 forks source link

message processing order for actors on the same locality #41

Closed basiliscos closed 2 years ago

basiliscos commented 2 years ago

Currently the order of messaging is preserved, i.e. when message m1 follows m2, they will be processed by an actor as m1, then m2. This is correct, and what is expected.

However, them messages are sent to the same address, where actors (a1 and a2), belong to supervisors but the same locality, are subscribed, they are processed in the following order (we assume that a1 subscribed "earlier" then a2):

a1 processes m1, then m2 , and then a2 processes m1 and then m2

Generally speaking, this is correct, however this is not what is expected: using the same locality, means, that actors use the same thread (or same context), and can access to shared resources without synchronization. So, the expected order of processing should be:

a1 processes m1 a2 processes m1 a1 processes m2 a2 processes m2

basiliscos commented 2 years ago

done with v0.20