This example for websocket++ is exactly what I want to do at its' core.
While the users can easily be tracked with websocketpp::connection_hdl
, I need to keep more information on them much like how stack probably keeps track of which page we're looking at to update votes, comments, answers, messages in the upper left corner, etc.
I just found out that the std::queue
is not perfectly thread-safe does .push() fail or wait while locked in this code example? and am going to find a way (probably with a stack q) to work in boost::lockfree::queue
Thread-Safe C/C++ queue optimized for push. More importantly, I just found out that thread-safe vectors are much more trouble Threadsafe Vector class for C++
From the code in the first link, how can I track user data (such as the currently viewed stack question) thread-safely without locking & blocking?