Sometimes before performing the appropriate operations on commands they must be gathered from different flows asynchronously.
Typically in a parallel game players send their orders asynchronously, whereas a serial game is driven by the commands synchronously : player send orders to the moderator which replies with result and updates immediatly.
Furthermore commands can be considered as :
Instant commands do not require any synchronization mechanism : they are simply executed as soon as received.
A chat order has to be instant because it has nothing to do with the turn processing.
A move order in the game of chess also has to be instant because this game is serial and therefore the game control is driven by players actions.
In the board game Diplomacy players send their orders asynchronously.
Until they get processed delayed commands have to be stored, which is the main purpose of the barrier.
The barrier bufferizes all commands it receives and releases them as a single flow once a specific condition is met.
Some typical release conditions are :
Those conditions hence fall into two different types :
A barrier is typically based on the buffer component with extra features to cope with the different release modes.
The role of this special command is to notify a barrier that the command flow can be marked as finished.
Once all command flows are marked, the barrier automatically releases the commands.
If other commands arrive from a marked flow, it gets unmarked.
As soon as the barrier has released the commands it unmarks all flows.
Pb to ID incomming flows : use User ?