The class is using an incredibly elaborate setup to create and destroy an NSAutoreleasePool object. We can do it in a much simpler way by making those calls inside our thread startup function. The only effect of this patch is that the pool gets released at the end of the ThreadCreateTrampoline function, instead of slightly later, when pthreads begin thread-specific cleanup. However, the key destruction order is unspecified, so nothing should be relying on that. I didn't find a specific reason for why this would have to be done that way in git history. It seems that before D5198, this was thread-specific keys were the only way an os implementation (in Host::ThreadCreated) could attach some value to a thread. Differential Revision: https://reviews.llvm.org/D120322
21 lines
700 B
C++
21 lines
700 B
C++
//===-- HostThreadMacOSX.cpp ------------------------------------*- 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 "lldb/Host/macosx/HostThreadMacOSX.h"
|
|
#include <CoreFoundation/CoreFoundation.h>
|
|
#include <Foundation/Foundation.h>
|
|
|
|
using namespace lldb_private;
|
|
|
|
lldb::thread_result_t
|
|
HostThreadMacOSX::ThreadCreateTrampoline(lldb::thread_arg_t arg) {
|
|
@autoreleasepool {
|
|
return HostThreadPosix::ThreadCreateTrampoline(arg);
|
|
}
|
|
}
|