amethyst / shred

Shared resource dispatcher
Apache License 2.0
234 stars 66 forks source link

Validate for conflicts in ParSeq #148

Closed farnoy closed 5 years ago

farnoy commented 5 years ago

It would be great if there was a way of confidently writing par! and seq! macros knowing that they'll get validated later. It should be easier to balance stages this way rather than tweaking running_time() and looking at the effects. Right now we're running a risk of conflicting reads with writes if we use these macros. From what I can tell, the logic for validation is already there in StagesBuilder, but it probably can't be reused 1:1.

farnoy commented 5 years ago

I just tried it out and noticed it's already implemented. Tried to add system with conflicting reads / writes. :man_facepalming:

farnoy commented 5 years ago

In my defence, the documentation does not match the code:

This is more flexible and performant than Dispatcher, however, you have to check conflicts yourself. That means you cannot run two systems in parallel which write to the same resource; if you'd do that, one of the systems will panic while trying to fetch the SystemData.