Rewrite raw memcard threading code. Intended to fix issue 7484.

Busy loop is rarely the right answer, even less when you are waiting for IO that might take an unknown amount of time. I'm fine with busy loops that are <1ms, anything else should use an event/cvar imo.

Please use Common::Flag instead of raw bool atomics. It makes it more obvious that this is a "safe" multithread access by not having an automatic conversion to bool (you have to explicitly IsSet() instead).