[vm] Further make [os_]thread_absl.cc compatible with Mac.

TEST=ci, cbuild
Change-Id: I0fa9c11bbe826f71494cc9f7c89caed4f3597629
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/238161
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
This commit is contained in:
Ryan Macnak 2022-03-22 22:41:50 +00:00 committed by Commit Bot
parent 05a6506c92
commit c4e913c839
9 changed files with 15 additions and 9 deletions

View file

@ -129,7 +129,7 @@ const char* CanonicalFunction(const char* func);
#define API_TIMELINE_BEGIN_END(thread) \
do { \
} while (false)
#endif // !PRODUCT
#endif // SUPPORT_TIMELINE
class Api : AllStatic {
public:

View file

@ -253,7 +253,7 @@ class OSThread : public BaseThread {
static void Cleanup();
#ifdef SUPPORT_TIMELINE
static ThreadId GetCurrentThreadTraceId();
#endif // PRODUCT
#endif // SUPPORT_TIMELINE
static OSThread* GetOSThreadFromThread(ThreadState* thread);
static void AddThreadToListLocked(OSThread* thread);
static void RemoveThreadFromList(OSThread* thread);

View file

@ -219,9 +219,15 @@ ThreadId OSThread::GetCurrentThreadId() {
#ifdef SUPPORT_TIMELINE
ThreadId OSThread::GetCurrentThreadTraceId() {
#if defined(DART_HOST_OS_ANDROID)
return GetCurrentThreadId();
#elif defined(DART_HOST_OS_LINUX)
return syscall(__NR_gettid);
#elif defined(DART_HOST_OS_MACOS)
return ThreadIdFromIntPtr(pthread_mach_thread_np(pthread_self()));
#endif
}
#endif // PRODUCT
#endif // SUPPORT_TIMELINE
ThreadJoinId OSThread::GetCurrentThreadJoinId(OSThread* thread) {
ASSERT(thread != NULL);

View file

@ -215,7 +215,7 @@ ThreadId OSThread::GetCurrentThreadId() {
ThreadId OSThread::GetCurrentThreadTraceId() {
return GetCurrentThreadId();
}
#endif // PRODUCT
#endif // SUPPORT_TIMELINE
ThreadJoinId OSThread::GetCurrentThreadJoinId(OSThread* thread) {
ASSERT(thread != NULL);

View file

@ -170,7 +170,7 @@ ThreadId OSThread::GetCurrentThreadId() {
ThreadId OSThread::GetCurrentThreadTraceId() {
return pthread_self();
}
#endif // PRODUCT
#endif // SUPPORT_TIMELINE
ThreadJoinId OSThread::GetCurrentThreadJoinId(OSThread* thread) {
ASSERT(thread != NULL);

View file

@ -216,7 +216,7 @@ ThreadId OSThread::GetCurrentThreadId() {
ThreadId OSThread::GetCurrentThreadTraceId() {
return syscall(__NR_gettid);
}
#endif // PRODUCT
#endif // SUPPORT_TIMELINE
ThreadJoinId OSThread::GetCurrentThreadJoinId(OSThread* thread) {
ASSERT(thread != NULL);

View file

@ -194,7 +194,7 @@ ThreadId OSThread::GetCurrentThreadId() {
ThreadId OSThread::GetCurrentThreadTraceId() {
return ThreadIdFromIntPtr(pthread_mach_thread_np(pthread_self()));
}
#endif // PRODUCT
#endif // SUPPORT_TIMELINE
ThreadJoinId OSThread::GetCurrentThreadJoinId(OSThread* thread) {
ASSERT(thread != NULL);

View file

@ -133,7 +133,7 @@ ThreadId OSThread::GetCurrentThreadId() {
ThreadId OSThread::GetCurrentThreadTraceId() {
return ::GetCurrentThreadId();
}
#endif // PRODUCT
#endif // SUPPORT_TIMELINE
ThreadJoinId OSThread::GetCurrentThreadJoinId(OSThread* thread) {
ASSERT(thread != NULL);

View file

@ -547,7 +547,7 @@ class TimelineEvent {
#define TIMELINE_DURATION(thread, stream, name)
#define TIMELINE_FUNCTION_COMPILATION_DURATION(thread, name, function)
#define TIMELINE_FUNCTION_GC_DURATION(thread, name)
#endif // !PRODUCT
#endif // SUPPORT_TIMELINE
// See |TimelineBeginEndScope|.
class TimelineEventScope : public StackResource {