14#ifndef OR_TOOLS_MATH_OPT_CORE_SOLVE_INTERRUPTER_H_
15#define OR_TOOLS_MATH_OPT_CORE_SOLVE_INTERRUPTER_H_
23#include "absl/base/thread_annotations.h"
24#include "absl/strings/string_view.h"
25#include "absl/synchronization/mutex.h"
90 std::atomic<bool> interrupted_ =
false;
95 CallbackId next_callback_id_ ABSL_GUARDED_BY(mutex_) = {};
137 std::optional<SolveInterrupter::CallbackId> callback_id_;
ScopedSolveInterrupterCallback(SolveInterrupter *interrupter, SolveInterrupter::Callback callback)
~ScopedSolveInterrupterCallback()
void RemoveCallbackIfNecessary()
SolveInterrupter & operator=(const SolveInterrupter &)=delete
bool IsInterrupted() const
void RemoveInterruptionCallback(CallbackId id)
SolveInterrupter(const SolveInterrupter &)=delete
CallbackId AddInterruptionCallback(Callback callback)
SolveInterrupter()=default
std::function< void()> Callback
DEFINE_STRONG_INT_TYPE(CallbackId, int64_t)
std::function< CallbackResult(const CallbackData &)> Callback
Collection of objects used to extend the Constraint Solver library.