Add ref and returns the ref_count seen before added. The effect is basically same as butil::intrusive_ptr (obj).detach() except that the latter one does not return the seen ref_count which is useful in some scenarios.
| 42 | // except that the latter one does not return the seen ref_count which is |
| 43 | // useful in some scenarios. |
| 44 | int AddRefManually() |
| 45 | { return _nref.fetch_add(1, butil::memory_order_relaxed); } |
| 46 | |
| 47 | // Remove one ref, if the ref_count hit zero, delete this object. |
| 48 | // Same as butil::intrusive_ptr<T>(obj, false).reset(NULL) |
no test coverage detected