Skip to content

Commit

Permalink
Always use pthread_rwlock on Apple platforms (#70151)
Browse files Browse the repository at this point in the history
pthread_rwlock is faster than std::shared_mutex, especially in heavily
threaded code such as the Swift compiler.

rdar://117445844
  • Loading branch information
cooperp committed Oct 26, 2023
1 parent 5e51363 commit f74f213
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions llvm/include/llvm/Support/RWMutex.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,9 @@
#include <mutex>
#include <shared_mutex>

// std::shared_timed_mutex is only available on macOS 10.12 and later.
#if defined(__APPLE__) && defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__)
#if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 101200
#if defined(__APPLE__)
#define LLVM_USE_RW_MUTEX_IMPL
#endif
#endif

namespace llvm {
namespace sys {
Expand Down

0 comments on commit f74f213

Please sign in to comment.