refactor: make instance_id a incrementing integer instead of a point value

This commit is contained in:
CJ van den Berg 2026-03-10 13:08:34 +01:00
parent e75eb2d6cd
commit e1eefa2ca9
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9
2 changed files with 14 additions and 8 deletions

View file

@ -46,13 +46,9 @@ private:
auto operator==(const handle &, const handle &) -> bool;
/// Stable opaque actor identity: the raw instance pointer. Two handles for
/// the same actor return the same value. Returns 0 for expired handles.
[[nodiscard]] inline auto instance_id(const handle &h) -> uintptr_t {
// NOLINTNEXTLINE(*-reinterpret-cast)
if (auto sp = handle_ref(h).lock())
return reinterpret_cast<uintptr_t>(sp.get());
return 0;
}
/// Stable numeric actor identity assigned at spawn (atomic incrementing
/// counter, starting at 1). Two handles for the same actor return the same
/// value. Returns 0 for a null or expired handle.
[[nodiscard]] auto instance_id(const handle &h) -> uintptr_t;
} // namespace thespian