[lldb] Simplify HostThreadMacOSX
authorPavel Labath <pavel@labath.sk>
Mon, 21 Feb 2022 14:08:23 +0000 (15:08 +0100)
committerPavel Labath <pavel@labath.sk>
Wed, 23 Feb 2022 13:25:59 +0000 (14:25 +0100)
commitf4568e12219f3a6ada20035ea40223680e274203
tree4e5439dd026ba3326ac4923eaa754192f1239f18
parentd0810779b1f310d99176467d5d5b5aa4e26d7eb5
[lldb] Simplify HostThreadMacOSX

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
lldb/include/lldb/Host/macosx/HostThreadMacOSX.h
lldb/source/Host/macosx/objcxx/HostThreadMacOSX.mm