// Software Name : cppuprofile // SPDX-FileCopyrightText: Copyright (c) 2022 Orange // SPDX-License-Identifier: BSD-3-Clause // // This software is distributed under the BSD License; // see the LICENSE file for more details. // // Author: Cédric CHEDALEUX et al. #ifndef TIMER_H_ #define TIMER_H_ #include #include #include #include #include using namespace std; class Timer { public: explicit Timer(int interval /* ms */ = 0); virtual ~Timer(); void setTimeout(const function& timeout); void setInterval(int interval); void start(); void stop(); bool isRunning(); private: thread* m_th; bool m_running; int m_interval; std::mutex m_mutex; std::function m_timeout; }; #endif // TIMER_H_