xref: /llvm-project/compiler-rt/lib/gwp_asan/platform_specific/mutex_fuchsia.cpp (revision 3591721ada99810aeddfa3d4c83eea0dbeed7f18)
1*3591721aSKostya Kortchinsky //===-- mutex_fuchsia.cpp ---------------------------------------*- C++ -*-===//
2*3591721aSKostya Kortchinsky //
3*3591721aSKostya Kortchinsky // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4*3591721aSKostya Kortchinsky // See https://llvm.org/LICENSE.txt for license information.
5*3591721aSKostya Kortchinsky // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6*3591721aSKostya Kortchinsky //
7*3591721aSKostya Kortchinsky //===----------------------------------------------------------------------===//
8*3591721aSKostya Kortchinsky 
9*3591721aSKostya Kortchinsky #include "gwp_asan/mutex.h"
10*3591721aSKostya Kortchinsky 
11*3591721aSKostya Kortchinsky #include <lib/sync/mutex.h>
12*3591721aSKostya Kortchinsky 
13*3591721aSKostya Kortchinsky namespace gwp_asan {
lock()14*3591721aSKostya Kortchinsky void Mutex::lock() __TA_NO_THREAD_SAFETY_ANALYSIS { sync_mutex_lock(&Mu); }
15*3591721aSKostya Kortchinsky 
tryLock()16*3591721aSKostya Kortchinsky bool Mutex::tryLock() __TA_NO_THREAD_SAFETY_ANALYSIS {
17*3591721aSKostya Kortchinsky   return sync_mutex_trylock(&Mu) == ZX_OK;
18*3591721aSKostya Kortchinsky }
19*3591721aSKostya Kortchinsky 
unlock()20*3591721aSKostya Kortchinsky void Mutex::unlock() __TA_NO_THREAD_SAFETY_ANALYSIS { sync_mutex_unlock(&Mu); }
21*3591721aSKostya Kortchinsky } // namespace gwp_asan
22