mirror of https://github.com/ARMmbed/mbed-os.git
parent
3d4582bda0
commit
52aac4c756
|
@ -177,10 +177,7 @@ public:
|
|||
uint32_t use_count() const
|
||||
{
|
||||
if (_ptr != NULL) {
|
||||
core_util_critical_section_enter();
|
||||
uint32_t current_counter = *_counter;
|
||||
core_util_critical_section_exit();
|
||||
return current_counter;
|
||||
return core_util_atomic_load_u32(_counter);
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
|
@ -230,8 +227,7 @@ private:
|
|||
void decrement_counter()
|
||||
{
|
||||
if (_ptr != NULL) {
|
||||
uint32_t new_value = core_util_atomic_decr_u32(_counter, 1);
|
||||
if (new_value == 0) {
|
||||
if (core_util_atomic_decr_u32(_counter, 1) == 0) {
|
||||
delete _counter;
|
||||
_counter = NULL;
|
||||
delete _ptr;
|
||||
|
|
Loading…
Reference in New Issue