| 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 { |
| 14 | void Mutex::lock() __TA_NO_THREAD_SAFETY_ANALYSIS { sync_mutex_lock(&Mu); } |
| 15 | |
| 16 | bool Mutex::tryLock() __TA_NO_THREAD_SAFETY_ANALYSIS { |
| 17 | return sync_mutex_trylock(&Mu) == ZX_OK; |
| 18 | } |
| 19 | |
| 20 | void Mutex::unlock() __TA_NO_THREAD_SAFETY_ANALYSIS { sync_mutex_unlock(&Mu); } |
| 21 | } // namespace gwp_asan |
| 22 | |