[Clang][SME2] Enable multi-vector loads & stores for SME2 (#75821)
[llvm-project.git] / compiler-rt / lib / gwp_asan / platform_specific / mutex_posix.cpp
blob8bd405e1074cb39f7ce3a54cd53f5c49845e4e88
1 //===-- mutex_posix.cpp -----------------------------------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
9 #include "gwp_asan/mutex.h"
11 #include <assert.h>
12 #include <pthread.h>
14 namespace gwp_asan {
15 void Mutex::lock() {
16 int Status = pthread_mutex_lock(&Mu);
17 assert(Status == 0);
18 // Remove warning for non-debug builds.
19 (void)Status;
22 bool Mutex::tryLock() { return pthread_mutex_trylock(&Mu) == 0; }
24 void Mutex::unlock() {
25 int Status = pthread_mutex_unlock(&Mu);
26 assert(Status == 0);
27 // Remove warning for non-debug builds.
28 (void)Status;
30 } // namespace gwp_asan