private SoundResource loadResource(ILibrary lib, string resName) { Basket b = new Basket(); ResourceManager mgr = this; AutoResetEvent signal = new AutoResetEvent(false); string fullName = lib.Name + "::" + resName; syncAction(() => { b.res = new SoundResource(mgr, fullName, lib.OpenStream(resName), lib.FileFormat(resName)); b.res.init(); signal.Set(); }); signal.WaitOne(); _loaded[fullName] = b.res; return b.res; }