Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
Signed-off-by: luohaha <[email protected]>
  • Loading branch information
luohaha committed Nov 26, 2024
1 parent b4f76c2 commit 908b6ed
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions be/src/util/compression/compression_context_pool.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,18 +115,15 @@ class CompressionContextPool {
private:
void add(InternalRef ptr) {
// Use explicit producer token to avoid the overhead of too many sub-queues
static thread_local std::unique_ptr<::moodycamel::ProducerToken> producer_token;
if (producer_token == nullptr) {
producer_token = std::make_unique<::moodycamel::ProducerToken>(_ctx_resources);
}
static thread_local ::moodycamel::ProducerToken producer_token(_ctx_resources);
DCHECK(ptr);
Status status = _resetter(ptr.get());
// if reset fail, then delete this context
if (!status.ok()) {
return;
}

_ctx_resources.enqueue(*producer_token, std::move(ptr));
_ctx_resources.enqueue(producer_token, std::move(ptr));
}

Creator _creator;
Expand Down

0 comments on commit 908b6ed

Please sign in to comment.