Merge pull request #47098 from CheSema/release-lambda-before

release lambda resources before detaching thread group
This commit is contained in:
Sema Checherinda 2023-03-02 15:28:18 +01:00 committed by GitHub
commit bd5d7f3f81
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -25,8 +25,16 @@ ThreadPoolCallbackRunner<Result, Callback> threadPoolCallbackRunner(ThreadPool &
CurrentThread::attachTo(thread_group);
SCOPE_EXIT_SAFE({
{
/// Release all captutred resources before detaching thread group
/// Releasing has to use proper memory tracker which has been set here before callback
[[maybe_unused]] auto tmp = std::move(callback);
}
if (thread_group)
CurrentThread::detachQueryIfNotDetached();
});
setThreadName(thread_name.data());