Files
core_misc/tjp/core/time-obsolete/SchedulerPool.hpp
Timothy Prepscius fa54be052a flatten 20260225
2026-02-25 12:39:24 -05:00

48 lines
979 B
C++

// TJP COPYRIGHT HEADER
//
// Timer.h
// algorithm
//
// Created by Timothy Prepscius on 1/19/18.
// Copyright © 2018 Timothy Prepscius. All rights reserved.
//
#pragma once
#include "SchedulerPool.h"
#include "Scheduler.hpp"
#include <core/threads/Lock.hpp>
#include <core/ptr/Ptr.hpp>
#include <map>
#include <set>
namespace timprepscius {
namespace core {
namespace time {
struct SchedulerPool : StrongThis<SchedulerPool>
{
QMutex mutex;
std::set<SchedulerEventPtr> events;
std::atomic<size_t> nextIndex;
std::map<size_t, SchedulerEventPtr> onces;
SchedulerPtr scheduler;
SchedulerPool();
virtual ~SchedulerPool ();
SchedulerEventPtr schedule(const SchedulerPtr &scheduler, Time period, std::function<void()> &&f);
SchedulerEventPtr once(const SchedulerPtr &scheduler, Time offset, std::function<void()> &&f);
void remove_once(size_t index);
void remove_once_no_lock(size_t index);
void clear();
} ;
} // namespace
} // namespace
} // namespace