mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-13 03:41:48 +00:00
38 lines
679 B
C++
38 lines
679 B
C++
#ifndef __RESOLVSERVICE_HPP__
|
|
#define __RESOLVSERVICE_HPP__
|
|
|
|
#include <atomic>
|
|
#include <condition_variable>
|
|
#include <functional>
|
|
#include <mutex>
|
|
#include <stdint.h>
|
|
#include <string>
|
|
#include <thread>
|
|
#include <vector>
|
|
|
|
class ResolvService
|
|
{
|
|
struct QueueItem
|
|
{
|
|
uint32_t ip;
|
|
std::function<void(std::string&&)> callback;
|
|
};
|
|
|
|
public:
|
|
ResolvService();
|
|
~ResolvService();
|
|
|
|
void Query( uint32_t ip, const std::function<void(std::string&&)>& callback );
|
|
|
|
private:
|
|
void Worker();
|
|
|
|
std::atomic<bool> m_exit;
|
|
std::mutex m_lock;
|
|
std::condition_variable m_cv;
|
|
std::vector<QueueItem> m_queue;
|
|
std::thread m_thread;
|
|
};
|
|
|
|
#endif
|