llvm/libc/src/__support/threads/thread.cpp

//===--- Definitions of common thread items ---------------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#include "src/__support/threads/thread.h"
#include "src/__support/macros/config.h"
#include "src/__support/threads/mutex.h"

#include "src/__support/CPP/array.h"
#include "src/__support/CPP/mutex.h" // lock_guard
#include "src/__support/CPP/optional.h"
#include "src/__support/fixedvector.h"
#include "src/__support/macros/attributes.h"

namespace LIBC_NAMESPACE_DECL {
namespace {

AtExitCallback;

struct AtExitUnit {};

constexpr size_t TSS_KEY_COUNT =;

struct TSSKeyUnit {};

class TSSKeyMgr {};

TSSKeyMgr tss_key_mgr;

struct TSSValueUnit {};

static LIBC_THREAD_LOCAL cpp::array<TSSValueUnit, TSS_KEY_COUNT> tss_values;

} // anonymous namespace

class ThreadAtExitCallbackMgr {};

static LIBC_THREAD_LOCAL ThreadAtExitCallbackMgr atexit_callback_mgr;

// The function __cxa_thread_atexit is provided by C++ runtimes like libcxxabi.
// It is used by thread local object runtime to register destructor calls. To
// actually register destructor call with the threading library, it calls
// __cxa_thread_atexit_impl, which is to be provided by the threading library.
// The semantics are very similar to the __cxa_atexit function except for the
// fact that the registered callback is thread specific.
extern "C" int __cxa_thread_atexit_impl(AtExitCallback *callback, void *obj,
                                        void *) {}

namespace internal {

ThreadAtExitCallbackMgr *get_thread_atexit_callback_mgr() {}

void call_atexit_callbacks(ThreadAttributes *attrib) {}

} // namespace internal

cpp::optional<unsigned int> new_tss_key(TSSDtor *dtor) {}

bool tss_key_delete(unsigned int key) {}

bool set_tss_value(unsigned int key, void *val) {}

void *get_tss_value(unsigned int key) {}

} // namespace LIBC_NAMESPACE_DECL