diff --git a/private/queue_private.h b/private/queue_private.h index 60ae96e..23d2551 100644 --- a/private/queue_private.h +++ b/private/queue_private.h @@ -481,7 +481,6 @@ void dispatch_async_enforce_qos_class_f(dispatch_queue_t queue, void *_Nullable context, dispatch_function_t work); -#ifdef __ANDROID__ /*! * @function _dispatch_install_thread_detach_callback * @@ -494,7 +493,6 @@ dispatch_async_enforce_qos_class_f(dispatch_queue_t queue, */ DISPATCH_EXPORT void _dispatch_install_thread_detach_callback(void (*cb)(void)); -#endif __END_DECLS diff --git a/src/queue.c b/src/queue.c index 493de3f..a7b8708 100644 --- a/src/queue.c +++ b/src/queue.c @@ -7320,7 +7320,6 @@ _gettid(void) if ((f) && tsd->k) ((void(*)(void*))(f))(tsd->k); \ } while (0) -#ifdef __ANDROID__ static void (*_dispatch_thread_detach_callback)(void); void @@ -7330,7 +7329,6 @@ _dispatch_install_thread_detach_callback(void (*cb)(void)) DISPATCH_CLIENT_CRASH(0, "Installing a thread detach callback twice"); } } -#endif #if defined(_WIN32) static bool @@ -7383,6 +7381,9 @@ _libdispatch_tsd_cleanup(void *ctx) return; } #endif // defined(_WIN32) + if (_dispatch_thread_detach_callback) { + _dispatch_thread_detach_callback(); + } struct dispatch_tsd *tsd = (struct dispatch_tsd*) ctx; @@ -7405,11 +7406,7 @@ _libdispatch_tsd_cleanup(void *ctx) _tsd_call_cleanup(dispatch_voucher_key, _voucher_thread_cleanup); _tsd_call_cleanup(dispatch_deferred_items_key, _dispatch_deferred_items_cleanup); -#ifdef __ANDROID__ - if (_dispatch_thread_detach_callback) { - _dispatch_thread_detach_callback(); - } -#endif + tsd->tid = 0; }