mutex.cpp (0b57cec536236d46e3dba9bd041533462f33dbb7) mutex.cpp (e40139ff33b48b56a24c808b166b04b8ee6f5b21)
1//===------------------------- mutex.cpp ----------------------------------===//
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 "mutex"
10#include "limits"
11#include "system_error"
12#include "include/atomic_support.h"
13#include "__undef_macros"
14
15#ifndef _LIBCPP_HAS_NO_THREADS
1//===------------------------- mutex.cpp ----------------------------------===//
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 "mutex"
10#include "limits"
11#include "system_error"
12#include "include/atomic_support.h"
13#include "__undef_macros"
14
15#ifndef _LIBCPP_HAS_NO_THREADS
16#if defined(__unix__) && defined(__ELF__) && defined(_LIBCPP_HAS_COMMENT_LIB_PRAGMA)
16#if defined(__unix__) && !defined(__ANDROID__) && defined(__ELF__) && defined(_LIBCPP_HAS_COMMENT_LIB_PRAGMA)
17#pragma comment(lib, "pthread")
18#endif
19#endif
20
21_LIBCPP_BEGIN_NAMESPACE_STD
22#ifndef _LIBCPP_HAS_NO_THREADS
23
17#pragma comment(lib, "pthread")
18#endif
19#endif
20
21_LIBCPP_BEGIN_NAMESPACE_STD
22#ifndef _LIBCPP_HAS_NO_THREADS
23
24const defer_lock_t defer_lock = {};
25const try_to_lock_t try_to_lock = {};
26const adopt_lock_t adopt_lock = {};
24const defer_lock_t defer_lock{};
25const try_to_lock_t try_to_lock{};
26const adopt_lock_t adopt_lock{};
27
28// ~mutex is defined elsewhere
29
30void
31mutex::lock()
32{
33 int ec = __libcpp_mutex_lock(&__m_);
34 if (ec)

--- 226 unchanged lines hidden ---
27
28// ~mutex is defined elsewhere
29
30void
31mutex::lock()
32{
33 int ec = __libcpp_mutex_lock(&__m_);
34 if (ec)

--- 226 unchanged lines hidden ---