Skip to content

Commit

Permalink
Refine join probe (#7156)
Browse files Browse the repository at this point in the history
close #5900
  • Loading branch information
SeaRise authored Apr 10, 2023
1 parent e0c82c0 commit 0f82b2e
Show file tree
Hide file tree
Showing 7 changed files with 514 additions and 274 deletions.
11 changes: 9 additions & 2 deletions dbms/src/Common/PtrHolder.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#pragma once

#include <mutex>
#include <optional>

namespace DB
{
Expand All @@ -26,7 +27,6 @@ class PtrHolder
{
assert(obj_);
std::lock_guard lock(mu);
assert(!obj);
obj = std::move(obj_);
}

Expand All @@ -39,13 +39,20 @@ class PtrHolder
return res;
}

auto operator->()
auto * operator->()
{
std::lock_guard lock(mu);
assert(obj != nullptr);
return obj.get();
}

auto & operator*()
{
std::lock_guard lock(mu);
assert(obj != nullptr);
return *obj.get();
}

private:
std::mutex mu;
Ptr obj;
Expand Down
Loading

0 comments on commit 0f82b2e

Please sign in to comment.