diff --git a/llvm/lib/Debuginfod/Debuginfod.cpp b/llvm/lib/Debuginfod/Debuginfod.cpp index c1cab8d79cabd..9df30ab55cbad 100644 --- a/llvm/lib/Debuginfod/Debuginfod.cpp +++ b/llvm/lib/Debuginfod/Debuginfod.cpp @@ -51,7 +51,7 @@ using llvm::object::BuildIDRef; namespace { std::optional> DebuginfodUrls; // Many Readers/Single Writer lock protecting the global debuginfod URL list. -std::shared_mutex UrlsMutex; +llvm::sys::RWMutex UrlsMutex; } // namespace static std::string uniqueKey(llvm::StringRef S) { @@ -69,12 +69,12 @@ bool canUseDebuginfod() { } SmallVector getDefaultDebuginfodUrls() { - std::shared_lock ReadGuard(UrlsMutex); + std::shared_lock ReadGuard(UrlsMutex); if (!DebuginfodUrls) { // Only read from the environment variable if the user hasn't already // set the value ReadGuard.unlock(); - std::unique_lock WriteGuard(UrlsMutex); + std::unique_lock WriteGuard(UrlsMutex); DebuginfodUrls = SmallVector(); if (const char *DebuginfodUrlsEnv = std::getenv("DEBUGINFOD_URLS")) { StringRef(DebuginfodUrlsEnv) @@ -88,7 +88,7 @@ SmallVector getDefaultDebuginfodUrls() { // Set the default debuginfod URL list, override the environment variable void setDefaultDebuginfodUrls(const SmallVector &URLs) { - std::unique_lock WriteGuard(UrlsMutex); + std::unique_lock WriteGuard(UrlsMutex); DebuginfodUrls = URLs; }