mirror of
https://github.com/boykopovar/AnyPS5.git
synced 2026-11-04 13:07:32 +00:00
sceSaveDataInitialize3 started the callback delivery thread for every title that initializes save data, though nearly none register a callback, and could throw there if scePthreadCreate failed. The thread now starts at the first successful sceSaveDataRegisterEventCallback of an initialization, under the calling, g_slots_mutex and callbacks.mutex locks that registration already takes, so a title that never registers gets no thread and sceSaveDataInitialize3 is again only the count. A replacing registration, one from inside a callback and one after an unregister reuse the running thread; a refused one starts nothing. The last sceSaveDataTerminate still takes the worker out under g_slots_mutex and joins it outside the lock, and only when one was started, so a session that registers between that terminate's detach and its join starts its own thread. The tests run two sessions with no registration, and on Linux count the process's threads to check that Initialize3 and a refused registration start none, that the first registration starts one and later ones reuse it, and that the final terminate joins it.