xref: /freebsd/contrib/llvm-project/compiler-rt/lib/gwp_asan/platform_specific/mutex_fuchsia.cpp (revision e8d8bef961a50d4dc22501cde4fb9fb0be1b2532)
1 //===-- mutex_fuchsia.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 //===----------------------------------------------------------------------===//
8 
9 #include "gwp_asan/mutex.h"
10 
11 #include <lib/sync/mutex.h>
12 
13 namespace gwp_asan {
lock()14 void Mutex::lock() __TA_NO_THREAD_SAFETY_ANALYSIS { sync_mutex_lock(&Mu); }
15 
tryLock()16 bool Mutex::tryLock() __TA_NO_THREAD_SAFETY_ANALYSIS {
17   return sync_mutex_trylock(&Mu) == ZX_OK;
18 }
19 
unlock()20 void Mutex::unlock() __TA_NO_THREAD_SAFETY_ANALYSIS { sync_mutex_unlock(&Mu); }
21 } // namespace gwp_asan
22