Atharva Chiplunkar created THRIFT-5897:
------------------------------------------
Summary: Use read lock for listener access in
TServerSocket.Accept()
Key: THRIFT-5897
URL: https://issues.apache.org/jira/browse/THRIFT-5897
Project: Thrift
Issue Type: Bug
Components: Go - Library
Reporter: Atharva Chiplunkar
Assignee: Atharva Chiplunkar
Currently, TServerSocket.Accept() uses two separate lock acquisitions:
1. RLock for reading 'interrupted' field
2. write lock for reading 'listener' field
Since both fields are only being read (not modified), both can be protected
by a single read lock (RLock). This optimization:
- Reduces lock contention by eliminating unnecessary write lock
- Allows multiple Accept() calls to proceed concurrently
Change:
- Combine both field reads under a single RLock/RUnlock pair
- Remove unnecessary write lock (Lock/Unlock)
This is a performance optimization with no functional change.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)