Hello there was a question in the synchronization of a separate part of the application, here is an example:
class Server : public IServer { public: typedef std::shared_ptr<boost::asio::ip::tcp::socket> SPtrClientSocket; ... void startServer() override; void stopServer() override; private: ... void addClient(const SPtrClientSocket& client); void removeClient(); private: ... std::mutex mtx; std::queue<SPtrClientSocket> _clients; }; void Server::addClient(const SPtrClientSocket& client) { std::lock_guard<std::mutex> lock(mtx); _clients.push(client); } void Server::removeClient() { std::lock_guard<std::mutex> lock(mtx); _clients.pop(); } Apparently from an example, I have a server on which clients connect. One thread listens to the connection and adds clients to the queue, another one then performs some actions with this client sends it the result and removes it from the queue. In this regard, I doubt a little about the correctness of my synchronization, will it be possible for UD? Can someone tell you the best synchronization option for this case? Thank you in advance...