Returns a copy instead of a reference for thread safety. Current usage: Only called by Span2Proto() which immediately passes the result to protobuf's set_info(). In this specific scenario, returning a reference would also be safe because set_info() copies the string before the reference could be invalidated by concurrent Annotate() calls. However, returning by value is more robust: it prevents p
| 193 | // future code holds the reference longer, and has no performance penalty due to |
| 194 | // C++11 move semantics (the temporary is moved, not copied, into protobuf). |
| 195 | std::string info() const { |
| 196 | BAIDU_SCOPED_LOCK(_info_spinlock); |
| 197 | return _info; |
| 198 | } |
| 199 | |
| 200 | private: |
| 201 | DISALLOW_COPY_AND_ASSIGN(Span); |
no outgoing calls
no test coverage detected