Files
sdk/runtime/vm/os_thread_absl.h
T
Vyacheslav Egorov e105029f62 [vm] Move synchronization primitives to platform
This CL also removes ability to assign names to mutexes which was
added in c25ebfff96 but did not yield
any interesting data.

TEST=ci

CoreLibraryReviewExempt: Changes to dart:concurrent only.
Cq-Include-Trybots: luci.dart.try:vm-fuchsia-release-x64-try,vm-win-debug-x64-try,vm-win-release-x64-try,vm-aot-linux-product-x64-try
Change-Id: Id41e1d29832f6008e02f0a571ee67564e1a84224
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/375300
Reviewed-by: Martin Kustermann <kustermann@google.com>
2024-08-07 12:59:35 +00:00

44 lines
1.1 KiB
C++

// Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
#ifndef RUNTIME_VM_OS_THREAD_ABSL_H_
#define RUNTIME_VM_OS_THREAD_ABSL_H_
#if !defined(RUNTIME_VM_OS_THREAD_H_)
#error Do not include os_thread_absl.h directly; use os_thread.h instead.
#endif
#include <pthread.h>
#include "platform/assert.h"
#include "platform/globals.h"
namespace dart {
typedef pthread_key_t ThreadLocalKey;
typedef pthread_t ThreadJoinId;
static const ThreadLocalKey kUnsetThreadLocalKey =
static_cast<pthread_key_t>(-1);
class ThreadInlineImpl {
private:
ThreadInlineImpl() {}
~ThreadInlineImpl() {}
static uword GetThreadLocal(ThreadLocalKey key) {
ASSERT(key != kUnsetThreadLocalKey);
return reinterpret_cast<uword>(pthread_getspecific(key));
}
friend class OSThread;
DISALLOW_ALLOCATION();
DISALLOW_COPY_AND_ASSIGN(ThreadInlineImpl);
};
} // namespace dart
#endif // RUNTIME_VM_OS_THREAD_ABSL_H_