refactor: make instance_id a incrementing integer instead of a point value
This commit is contained in:
parent
e75eb2d6cd
commit
e1eefa2ca9
2 changed files with 14 additions and 8 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue