chenBright commented on code in PR #2632: URL: https://github.com/apache/brpc/pull/2632#discussion_r1591734105
########## src/butil/thread_key.h: ########## @@ -187,9 +205,9 @@ void ThreadLocal<T>::reset(T* ptr) { } // Remove and delete old_ptr. if (old_ptr) { - auto iter = std::find(ptrs.begin(), ptrs.end(), old_ptr); - if (iter!=ptrs.end()) { - ptrs.erase(iter); + auto iter = std::remove(ptrs.begin(), ptrs.end(), old_ptr); + if (iter != ptrs.end()) { + ptrs.erase(iter, ptrs.end()); Review Comment: remove只是将符合条件的数据放到了vector后面,并没有实际删除,所以还需要erase。 -- 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: dev-unsubscr...@brpc.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@brpc.apache.org For additional commands, e-mail: dev-h...@brpc.apache.org