[ https://issues.apache.org/jira/browse/THRIFT-4557?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16441987#comment-16441987 ]
ASF GitHub Bot commented on THRIFT-4557: ---------------------------------------- jiajunhuang closed pull request #1545: THRIFT-4557: use RWMutex for better concurrency performance URL: https://github.com/apache/thrift/pull/1545 This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): diff --git a/lib/go/thrift/simple_server.go b/lib/go/thrift/simple_server.go index 6035802516..b659e3d84a 100644 --- a/lib/go/thrift/simple_server.go +++ b/lib/go/thrift/simple_server.go @@ -34,7 +34,7 @@ import ( type TSimpleServer struct { closed int32 wg sync.WaitGroup - mu sync.Mutex + mu sync.RWMutex processorFactory TProcessorFactory serverTransport TServerTransport @@ -127,8 +127,8 @@ func (p *TSimpleServer) Listen() error { func (p *TSimpleServer) innerAccept() (int32, error) { client, err := p.serverTransport.Accept() - p.mu.Lock() - defer p.mu.Unlock() + p.mu.RLock() + defer p.mu.RUnlock() closed := atomic.LoadInt32(&p.closed) if closed != 0 { return closed, nil ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > use RWLock instead of Lock > -------------------------- > > Key: THRIFT-4557 > URL: https://issues.apache.org/jira/browse/THRIFT-4557 > Project: Thrift > Issue Type: Improvement > Components: Go - Library > Reporter: gansteed > Priority: Major > > use Read-Write Lock to protect `p.closed` -- This message was sent by Atlassian JIRA (v7.6.3#76005)