File tree Expand file tree Collapse file tree
include/ipfixprobe/outputPlugin/outputStorage Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ class ReferenceCounter {
2828
2929 T& getData () noexcept { return m_data.get (); }
3030
31- void incrementUserCount () noexcept { m_refCount->fetch_add (1 , std::memory_order_acq_rel ); }
31+ void incrementUserCount () noexcept { m_refCount->fetch_add (1 , std::memory_order_relaxed ); }
3232
3333 uint8_t decrementUserCount ()
3434 {
@@ -96,19 +96,13 @@ class Reference {
9696 if (m_counter == other.m_counter ) {
9797 throw std::runtime_error (" Both references point to the same counter" );
9898 }
99- const uint8_t userCount = m_counter->decrementUserCount ();
100- const bool noMoreUsers = userCount == 1 ;
99+ other.m_counter ->incrementUserCount ();
101100 auto * oldCounter = m_counter;
102- /* if (userCount == 0) {
103- allocationBuffer.deallocate(m_counter);
104- }*/
105101 m_counter = other.m_counter ;
106- m_counter-> incrementUserCount ();
107- if (noMoreUsers ) {
102+ const uint8_t userCount = oldCounter-> decrementUserCount ();
103+ if (userCount == 1 ) {
108104 onDestructorCallback (oldCounter);
109105 }
110-
111- // return noMoreUsers;
112106 }
113107
114108 auto && getCounter(this auto && self) noexcept { return self.m_counter ; }
You can’t perform that action at this time.
0 commit comments