fix(agc,shader): prime the two host shared mutexes added after 48dcaace7

Commit 48dcaace7 introduced PrimedSharedMutex and converted every host std::shared_mutex that existed at the time, because winpthreads initializes a static rwlock on first use and a concurrent first lock returns EINVAL, which std::shared_mutex ignores (docs/dev/TechnicalDebt.md:10).

Two host mutexes were added afterward and missed the conversion:
- Recompiler.cpp registrationModule() static mutex (added by baf3437465)
- MultisampleTarget.cpp guardedMutex() static mutex (added by d109f3966f)

Apply the same priming. Recompiler.cpp reuses the PrimedSharedMutex already defined in that translation unit; MultisampleTarget.cpp gets the identical local helper to match the existing inline precedent.

Tested: Windows 11 x64, WinLibs GCC 15.2.0 (matches CI). Compiled Recompiler.cpp.obj and all three MultisampleTarget.cpp.obj targets with the project build flags; check_conventions.py passes.
This commit is contained in:
Mohamed Aziz Hadjkacem 2026-10-12 16:51:53 +01:00
parent 8fa5cc4866
commit 4d37c93364
2 changed files with 10 additions and 2 deletions

View File

@ -173,8 +173,16 @@ struct GuardedRange {
std::uint32_t samples;
};
class PrimedSharedMutex : public std::shared_mutex {
public:
PrimedSharedMutex() {
lock();
unlock();
}
};
std::shared_mutex& guardedMutex() {
static std::shared_mutex mutex;
static PrimedSharedMutex mutex;
return mutex;
}

View File

@ -623,7 +623,7 @@ struct RegistrationModuleEntry {
std::shared_ptr<const SpecializedModule> registrationModule(std::uint64_t variantId, std::span<const std::uint32_t> moduleKey, const std::function<std::shared_ptr<const SpecializedModule>()>& specialize) {
std::vector<std::uint64_t> key{variantId};
key.insert(key.end(), moduleKey.begin(), moduleKey.end());
static std::shared_mutex mutex;
static PrimedSharedMutex mutex;
static std::map<std::vector<std::uint64_t>, std::shared_ptr<RegistrationModuleEntry>> modules;
std::shared_ptr<RegistrationModuleEntry> entry;
{