C++ Multithreaded server help
Posted
by
kisplit
on Stack Overflow
See other posts from Stack Overflow
or by kisplit
Published on 2011-01-09T15:46:26Z
Indexed on
2011/01/09
15:53 UTC
Read the original article
Hit count: 198
Hello all, I'm working on a multithreaded server in c++ using boost-asio. Currently a design problem I'm running into deals with erasing a connection.
I have a single server instance which holds a vector of connection objects. These connections receive commands which I parse. One command in particular deals with sending data to ALL connections in my vector.
Now when a connection disconnects I'm currently erasing this connection from the vector and calling the destructor. It seems like I'm going to run into problems when someone 'SendAll' at the same time someone 'Disconnect'.
Could anyone recommend a better design or just point me in the right direction? Any help greatly appreciated. Thanks
© Stack Overflow or respective owner