1
0
Fork 0
mirror of https://github.com/Atmosphere-NX/Atmosphere.git synced 2024-10-01 03:13:25 +01:00
Atmosphere/stratosphere/libstratosphere/include/stratosphere/waitablemanager.hpp

26 lines
706 B
C++

#pragma once
#include <switch.h>
#include <vector>
#include "iwaitable.hpp"
class WaitableManager {
std::vector<IWaitable *> waitables;
u64 timeout;
private:
void process_internal(bool break_on_timeout);
public:
WaitableManager(u64 t) : waitables(0), timeout(t) { }
~WaitableManager() {
/* This should call the destructor for every waitable. */
for (auto & waitable : waitables) {
delete waitable;
}
waitables.clear();
}
unsigned int get_num_signalable();
void add_waitable(IWaitable *waitable);
void process();
void process_until_timeout();
};