locking/refcount: Consolidate implementations of refcount_t