xref: /aosp_15_r20/external/pigweed/pw_libcxx/include/__external_threading (revision 61c4878ac05f98d0ceed94b57d316916de578985)
1// Copyright 2024 The Pigweed Authors
2//
3// Licensed under the Apache License, Version 2.0 (the "License"); you may not
4// use this file except in compliance with the License. You may obtain a copy of
5// the License at
6//
7//     https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12// License for the specific language governing permissions and limitations under
13// the License.
14
15#pragma once
16
17// libc++'s <atomic> includes this file via <__threading_support>.  It needs
18// these types and functions declared, but only for use in interfaces that
19// aren't supported in Pigweed, so stub declarations are all they need.
20
21_LIBCPP_BEGIN_NAMESPACE_STD
22
23struct __libcpp_timespec_t {
24  long int tv_sec, tv_nsec;
25};
26
27using __libcpp_thread_id = int;
28
29bool __libcpp_thread_id_equal(__libcpp_thread_id, __libcpp_thread_id);
30bool __libcpp_thread_id_less(__libcpp_thread_id, __libcpp_thread_id);
31__libcpp_thread_id __libcpp_thread_get_current_id();
32
33void __libcpp_thread_sleep_for(chrono::nanoseconds);
34void __libcpp_thread_yield();
35
36// This macro is used unconditionally in <__threading_support> but defined
37// there only conditionally on when <__external_threading> is not used.
38#define _LIBCPP_THREAD_ABI_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
39
40using __libcpp_mutex_t = int;
41using __libcpp_recursive_mutex_t = int;
42using __libcpp_condvar_t = int;
43
44#define _LIBCPP_MUTEX_INITIALIZER {}
45#define _LIBCPP_CONDVAR_INITIALIZER {}
46
47_LIBCPP_END_NAMESPACE_STD
48