/* * Copyright (C) 2018-present ScyllaDB */ /* * SPDX-License-Identifier: AGPL-3.0-or-later */ #pragma once #include #include #include #include "seastarx.hh" class is_preemptible_tag; using is_preemptible = bool_class; /// A function which decides when to preempt. /// If it returns true then the algorithm will be interrupted. using preemption_check = noncopyable_function; inline preemption_check default_preemption_check() { return [] () noexcept { return seastar::need_preempt(); }; } inline preemption_check never_preempt() { return [] () noexcept { return false; }; } inline preemption_check always_preempt() { return [] () noexcept { return true; }; }