Skip to content

Commit

Permalink
delete: make impl::refs atomic
Browse files Browse the repository at this point in the history
Make refs atomic to enable distinct deleter objects on different
shards to safely share an underlying deleter::impl.

Maybe fixes scylladb#2450.
  • Loading branch information
travisdowns committed Sep 23, 2024
1 parent 1147ac2 commit 302e9c0
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion include/seastar/core/deleter.hh
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#pragma once

#ifndef SEASTAR_MODULE
#include <atomic>
#include <cassert>
#include <cstdint>
#include <cstdlib>
Expand Down Expand Up @@ -113,7 +114,7 @@ private:

/// \cond internal
struct deleter::impl {
unsigned refs = 1;
std::atomic<unsigned> refs = 1;
deleter next;
impl(deleter next) : next(std::move(next)) {}
virtual ~impl() {}
Expand Down

0 comments on commit 302e9c0

Please sign in to comment.