Implement basic network flow control (#2803)

Co-authored-by: Cameron Gutman <aicommander@gmail.com>
This commit is contained in:
ns6089
2024-07-11 03:03:16 +03:00
committed by GitHub
parent 6607a28a68
commit 037c61dc99
9 changed files with 352 additions and 101 deletions

View File

@@ -10,6 +10,8 @@
#include <mutex>
#include <string>
#include <boost/core/noncopyable.hpp>
#include "src/config.h"
#include "src/logging.h"
#include "src/stat_trackers.h"
@@ -799,4 +801,30 @@ namespace platf {
*/
std::vector<supported_gamepad_t> &
supported_gamepads(input_t *input);
struct high_precision_timer: private boost::noncopyable {
virtual ~high_precision_timer() = default;
/**
* @brief Sleep for the duration
* @param duration Sleep duration
*/
virtual void
sleep_for(const std::chrono::nanoseconds &duration) = 0;
/**
* @brief Check if platform-specific timer backend has been initialized successfully
* @return `true` on success, `false` on error
*/
virtual
operator bool() = 0;
};
/**
* @brief Create platform-specific timer capable of high-precision sleep
* @return A unique pointer to timer
*/
std::unique_ptr<high_precision_timer>
create_high_precision_timer();
} // namespace platf