Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@Qduuu
Copy link

@Qduuu Qduuu commented Sep 27, 2025

Changes

  • Replaced std::unique_lock<std::mutex> with std::lock_guard<std::mutex> in the accept handler since deferred locking is not needed.
  • Used move semantics (std::move(s)) when pushing the session into the container to avoid unnecessary shared_ptr copies.

Why

  • lock_guard is lighter than unique_lock and more suitable for this frequent operation (accepting connections).
  • Move semantics avoid atomic reference counting operations, which can improve performance in high-concurrency scenarios.

Modified Files

  • Lib/rpc/server.cc (the start_accept method)

Testing

  • Code compiles without errors.
  • Basic functionality tested and works correctly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant