FosterFramework / Foster

A small C# game framework
MIT License
422 stars 37 forks source link

Module shutdown order #67

Closed MrBrixican closed 6 months ago

MrBrixican commented 6 months ago

Currently, we shutdown modules in the same order we register them. This may not be ideal in cases where a module may depend on modules registered before it in its shutdown method (one notable example is a game module cleaning up audio resources dependent on an earlier registered audio module). To support such scenarios, it may be best to shutdown modules in reverse order.

Care must be taken for the unlikely edge case of modules being registered during shutdown (perhaps this should be disallowed entirely).

cerealpxl commented 6 months ago

This should be fixed in #68

NoelFB commented 6 months ago

Merged that in! I agree we should probably also not allow registering new modules during shutdown...

NoelFB commented 6 months ago

OK, I also don't allow new modules to be registered during shutdown. Should all be good now!