mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-12 14:09:12 +00:00
Make refcount reads explicitly atomic
This commit is contained in:
parent
9c68bc19b5
commit
8ed799bd4d
1 changed files with 2 additions and 2 deletions
|
@ -97,12 +97,12 @@ class shared_ref
|
|||
|
||||
size_t use_count() const noexcept
|
||||
{
|
||||
return shared + 1;
|
||||
return __atomic_load_n(&shared, __ATOMIC_RELAXED) + 1;
|
||||
}
|
||||
|
||||
size_t weak_count() const noexcept
|
||||
{
|
||||
return weak;
|
||||
return __atomic_load_n(&weak, __ATOMIC_RELAXED);
|
||||
}
|
||||
|
||||
private:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue