mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-08-03 08:20:28 +00:00
Rename refcounting methods
This commit is contained in:
parent
1fffa427c5
commit
2edff8f23a
2 changed files with 13 additions and 13 deletions
|
@ -53,28 +53,28 @@ namespace ctl {
|
|||
namespace __ {
|
||||
|
||||
void
|
||||
shared_control::add_shared() noexcept
|
||||
shared_control::keep_shared() noexcept
|
||||
{
|
||||
incref(&shared);
|
||||
}
|
||||
|
||||
void
|
||||
shared_control::release_shared() noexcept
|
||||
shared_control::drop_shared() noexcept
|
||||
{
|
||||
if (decref(&shared)) {
|
||||
on_zero_shared();
|
||||
release_weak();
|
||||
drop_weak();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
shared_control::add_weak() noexcept
|
||||
shared_control::keep_weak() noexcept
|
||||
{
|
||||
incref(&weak);
|
||||
}
|
||||
|
||||
void
|
||||
shared_control::release_weak() noexcept
|
||||
shared_control::drop_weak() noexcept
|
||||
{
|
||||
if (decref(&weak))
|
||||
on_zero_weak();
|
||||
|
|
|
@ -32,10 +32,10 @@ struct shared_control
|
|||
{
|
||||
}
|
||||
|
||||
void add_shared() noexcept;
|
||||
void release_shared() noexcept;
|
||||
void add_weak() noexcept;
|
||||
void release_weak() noexcept;
|
||||
void keep_shared() noexcept;
|
||||
void drop_shared() noexcept;
|
||||
void keep_weak() noexcept;
|
||||
void drop_weak() noexcept;
|
||||
size_t use_count() const noexcept;
|
||||
size_t weak_count() const noexcept;
|
||||
|
||||
|
@ -101,7 +101,7 @@ class shared_ptr
|
|||
shared_ptr(const shared_ptr& r) noexcept : p(r.p), ctl(r.ctl)
|
||||
{
|
||||
if (ctl)
|
||||
ctl->add_shared();
|
||||
ctl->keep_shared();
|
||||
}
|
||||
|
||||
shared_ptr(shared_ptr&& r) noexcept : p(r.p), ctl(r.ctl)
|
||||
|
@ -114,7 +114,7 @@ class shared_ptr
|
|||
shared_ptr(const shared_ptr<U>& r, T* const p) noexcept : p(p), ctl(r.ctl)
|
||||
{
|
||||
if (ctl)
|
||||
ctl->add_shared();
|
||||
ctl->keep_shared();
|
||||
}
|
||||
|
||||
template <typename U>
|
||||
|
@ -129,7 +129,7 @@ class shared_ptr
|
|||
~shared_ptr()
|
||||
{
|
||||
if (ctl)
|
||||
ctl->release_shared();
|
||||
ctl->drop_shared();
|
||||
}
|
||||
|
||||
shared_ptr& operator=(shared_ptr r) noexcept
|
||||
|
@ -141,7 +141,7 @@ class shared_ptr
|
|||
void reset() noexcept
|
||||
{
|
||||
if (ctl)
|
||||
ctl->release_shared();
|
||||
ctl->drop_shared();
|
||||
p = nullptr;
|
||||
ctl = nullptr;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue