wwbmmm commented on code in PR #1774:
URL: https://github.com/apache/incubator-brpc/pull/1774#discussion_r889794846
##########
src/brpc/socket.cpp:
##########
@@ -759,25 +761,31 @@ void Socket::Revive() {
butil::memory_order_relaxed)) {
// Set this flag to true since we add additional ref again
_recycle_flag.store(false, butil::memory_order_relaxed);
+ _recycle_mutex.unlock();
if (_user) {
_user->AfterRevived(this);
} else {
LOG(INFO) << "Revived " << *this << " (Connectable)";
}
return;
}
+ _recycle_mutex.unlock();
Review Comment:
可以用std::unique_lock包一下,这里就不用手动释放
##########
src/brpc/socket.h:
##########
@@ -787,6 +787,7 @@ friend void DereferenceSocket(Socket*);
// Flag used to mark whether additional reference has been decreased
// by either `SetFailed' or `SetRecycle'
butil::atomic<bool> _recycle_flag;
Review Comment:
既然都加锁了,这个就不需要是原子变量了吧?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]