22 lines · cpp
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-exception6//7//===----------------------------------------------------------------------===//8 9#include "gwp_asan/mutex.h"10 11#include <lib/sync/mutex.h>12 13namespace gwp_asan {14void Mutex::lock() __TA_NO_THREAD_SAFETY_ANALYSIS { sync_mutex_lock(&Mu); }15 16bool Mutex::tryLock() __TA_NO_THREAD_SAFETY_ANALYSIS {17 return sync_mutex_trylock(&Mu) == ZX_OK;18}19 20void Mutex::unlock() __TA_NO_THREAD_SAFETY_ANALYSIS { sync_mutex_unlock(&Mu); }21} // namespace gwp_asan22