21 #include <glog/logging.h> 57 std::shared_ptr<ControlBlock> controlBlock,
75 return numPriorities_;
88 DCHECK(keepAliveCount > 0);
95 DCHECK(keepAliveCount >= 1);
97 if (keepAliveCount == 1) {
104 controlBlock_->keepAliveCount_.load(std::memory_order_relaxed);
106 if (controlBlock == 0) {
109 }
while (!
controlBlock_->keepAliveCount_.compare_exchange_weak(
112 std::memory_order_release,
113 std::memory_order_relaxed));
127 auto keepAliveCount =
128 controlBlock_->keepAliveCount_.fetch_add(1, std::memory_order_relaxed);
130 DCHECK(keepAliveCount > 0);
135 auto keepAliveCount =
136 controlBlock_->keepAliveCount_.fetch_sub(1, std::memory_order_acquire);
137 DCHECK(keepAliveCount >= 1);
139 if (keepAliveCount == 1) {
144 std::shared_ptr<ControlBlock>
controlBlock_{std::make_shared<ControlBlock>()};
147 makeKeepAlive<DefaultKeepAliveExecutor>(
this)};
bool keepAliveAcquire() override
void addWithPriority(Func f, int8_t priority) override
virtual ~DefaultKeepAliveExecutor()
constexpr detail::Map< Move > move
std::shared_ptr< ControlBlock > controlBlock_
—— Concurrent Priority Queue Implementation ——
void keepAliveRelease() override
PUSHMI_INLINE_VAR constexpr __adl::get_executor_fn executor
virtual uint8_t getNumPriorities() const override
DefaultKeepAliveExecutor()
void keepAliveRelease() override
virtual uint8_t getNumPriorities() const
FOLLY_ALWAYS_INLINE void wait(const WaitOptions &opt=wait_options()) noexcept
auto lock(Synchronized< D, M > &synchronized, Args &&...args)
folly::Executor::KeepAlive lock()
bool keepAliveAcquire() override
std::shared_ptr< ControlBlock > controlBlock_
KeepAlive< DefaultKeepAliveExecutor > keepAlive_
folly::Executor::KeepAlive weakRef()
static folly::Executor::KeepAlive create(std::shared_ptr< ControlBlock > controlBlock, Executor *executor)
Baton keepAliveReleaseBaton_
WeakRef(std::shared_ptr< ControlBlock > controlBlock, Executor *executor)
static KeepAlive< ExecutorT > makeKeepAlive(ExecutorT *executor)
std::atomic< ssize_t > keepAliveCount_
void add(Func f) override