tracy/profiler/src/ResolvService.hpp

38 lines
679 B
C++
Raw Normal View History

2019-06-26 16:28:43 +00:00
#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