Merge pull request #15999 from ClickHouse/fix-after-15437

Continuation of 15437
This commit is contained in:
Nikolai Kochetov 2020-10-15 18:20:48 +03:00 committed by GitHub
commit 939d8edf33
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -164,7 +164,8 @@ public:
func = std::forward<Function>(func),
args = std::make_tuple(std::forward<Args>(args)...)]() mutable /// mutable is needed to destroy capture
{
SCOPE_EXIT(state->set());
auto event = std::move(state);
SCOPE_EXIT(event->set());
/// This moves are needed to destroy function and arguments before exit.
/// It will guarantee that after ThreadFromGlobalPool::join all captured params are destroyed.