#pragma once //#include #include #include #include #include #include // fwd struct ToxI; struct Tox_Events; class ToxIPCServer { ipc_sharedmemory _mem_rpc; ipc_sharedsemaphore _sem_rpc_c; ipc_sharedsemaphore _sem_rpc_s; ipc_sharedmemory _mem_events; ipc_sharedsemaphore _sem_events_lock; ToxI& _t; std::mutex& _t_m; std::atomic_bool _quit = false; std::thread _thread; std::vector _tmp_events_buf; void run(void); public: ToxIPCServer(ToxI& t, std::mutex& t_m); ~ToxIPCServer(void); bool connect(void); // starts a thread and serves void start(void); void stop(void); // take events, serialize void updateEvents(const Tox_Events* events); // this might sleep for longer, and events might get discarded void pub(void); };