flatten 20260225
This commit is contained in:
47
tjp/core/time-obsolete/SchedulerPool.hpp
Normal file
47
tjp/core/time-obsolete/SchedulerPool.hpp
Normal file
@@ -0,0 +1,47 @@
|
||||
// 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
|
||||
Reference in New Issue
Block a user