[libc-commits] [libc] [libc] Replace `MutexLock` with `cpp::lock_guard` (PR #89340)

Nick Desaulniers via libc-commits libc-commits at lists.llvm.org
Fri Apr 19 09:44:45 PDT 2024


================
@@ -27,7 +28,7 @@ ErrorOr<Dir *> Dir::open(const char *path) {
 }
 
 ErrorOr<struct ::dirent *> Dir::read() {
-  MutexLock lock(&mutex);
+  cpp::lock_guard<Mutex> lock(mutex);
----------------
nickdesaulniers wrote:

We're C++17; does that let us omit the `<Mutex>` part? If so please do here and throughout.  Example: https://godbolt.org/z/4c76K5Kb5

https://github.com/llvm/llvm-project/pull/89340


More information about the libc-commits mailing list