Add thread safety documentation

This commit is contained in:
2025-08-19 17:20:36 -04:00
parent b8d735f074
commit b7282a2f03
6 changed files with 347 additions and 9 deletions

View File

@@ -5,6 +5,16 @@
#include <errno.h>
#include <limits.h>
std::unique_ptr<Connection>
Connection::createForServer(struct sockaddr_storage addr, int fd, int64_t id,
ConnectionHandler *handler,
std::weak_ptr<Server> server) {
// Use unique_ptr constructor with private access (friend function)
// We can't use make_unique here because constructor is private
return std::unique_ptr<Connection>(
new Connection(addr, fd, id, handler, server));
}
Connection::Connection(struct sockaddr_storage addr, int fd, int64_t id,
ConnectionHandler *handler, std::weak_ptr<Server> server)
: fd_(fd), id_(id), addr_(addr), arena_(), handler_(handler),