methods called from disposing thread @cond
| 71 | private: // methods called from disposing thread |
| 72 | //@cond |
| 73 | void execute() |
| 74 | { |
| 75 | buffer_type * pBuffer; |
| 76 | uint64_t nCurEpoch; |
| 77 | bool bQuit = false; |
| 78 | |
| 79 | while ( !bQuit ) { |
| 80 | |
| 81 | // signal that we are ready to dispose |
| 82 | { |
| 83 | unique_lock lock( m_Mutex ); |
| 84 | m_bReady = true; |
| 85 | } |
| 86 | m_cvReady.notify_one(); |
| 87 | |
| 88 | { |
| 89 | // wait new data portion |
| 90 | unique_lock lock( m_Mutex ); |
| 91 | |
| 92 | while ( (pBuffer = m_pBuffer.load( atomics::memory_order_relaxed )) == nullptr ) |
| 93 | m_cvDataReady.wait( lock ); |
| 94 | |
| 95 | // New work is ready |
| 96 | m_bReady = false; // we are busy |
| 97 | |
| 98 | bQuit = m_bQuit; |
| 99 | nCurEpoch = m_nCurEpoch; |
| 100 | m_pBuffer.store( nullptr, atomics::memory_order_relaxed ); |
| 101 | } |
| 102 | |
| 103 | if ( pBuffer ) |
| 104 | dispose_buffer( pBuffer, nCurEpoch ); |
| 105 | } |
| 106 | } |
| 107 | |
| 108 | void dispose_buffer( buffer_type * pBuf, uint64_t nCurEpoch ) |
| 109 | { |
no test coverage detected