Original Post
My program will potentially be running multiple threads (through IOCP) so I need a way to protect the access to my variables. It''s a text based setup, so each room and entity has it''s own instance of a structure, all of which can be modified or just read from based on certain player actions. I realize that critical sections can be used to make sure only one thread at a time can get to certain variables, but does this mean I need to define a critical section for each data structure I have? That seems like quite a bit! If I had just one critical section per structure type then only one thread at a time could actually run and the others would all block even if they weren''t going after the exact same variables, so it seems like I would need a unique critical section for each... is there a better way? Is this going to crush performance somehow?