Currently the socket has two pointers: to the group and to its member data.
As there were reported concurrency issues, the m_GroupMemberData pointer is now atomic, but that may be not the right design decision. There must exist a mutex protection for just modification of the socket membership in the group, in particular:
- Whether a socket is a group member (or a single socket)
- The group membership data for a socket (maybe a container of these object is not the best way to keep members)
- Detaching a socket from the group in case when the group is requested to be closed
- Locking the state of membership of the socket, modified during closing, while other threads can perform some action basing on these data
Might be that the container to keep sockets in the group should keep just sockets themselves (consider something similar like in the multiplexer), while group membership data should be hooked in the socket itself.
Currently the socket has two pointers: to the group and to its member data.
As there were reported concurrency issues, the m_GroupMemberData pointer is now atomic, but that may be not the right design decision. There must exist a mutex protection for just modification of the socket membership in the group, in particular:
Might be that the container to keep sockets in the group should keep just sockets themselves (consider something similar like in the multiplexer), while group membership data should be hooked in the socket itself.