summaryrefslogtreecommitdiffstats
path: root/tools/profiler/core/platform-macos.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tools/profiler/core/platform-macos.cpp')
-rw-r--r--tools/profiler/core/platform-macos.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/tools/profiler/core/platform-macos.cpp b/tools/profiler/core/platform-macos.cpp
index 78f000c470..ad0b0699f3 100644
--- a/tools/profiler/core/platform-macos.cpp
+++ b/tools/profiler/core/platform-macos.cpp
@@ -256,7 +256,11 @@ SamplerThread::SamplerThread(PSLockRef aLock, uint32_t aActivityGeneration,
}
SamplerThread::~SamplerThread() {
- pthread_join(mThread, nullptr);
+ if (pthread_equal(mThread, pthread_self())) {
+ pthread_detach(mThread);
+ } else {
+ pthread_join(mThread, nullptr);
+ }
// Just in the unlikely case some callbacks were added between the end of the
// thread and now.
InvokePostSamplingCallbacks(std::move(mPostSamplingCallbackList),