int eDVBRecordFileThread::writeData(int len) { len = asyncWrite(len); if (len < 0) return len; // Wait for previous aio to complete on this buffer before returning int r = m_current_buffer->wait(); if (r < 0) return -1; return len; }
void eDVBRecordFileThread::flush() { eDebug("[eDVBRecordFileThread] waiting for aio to complete"); for (AsyncIOvector::iterator it = m_aio.begin(); it != m_aio.end(); ++it) { it->wait(); } int bufferCount = m_aio.size(); eDebug("[eDVBRecordFileThread] buffer usage histogram (%d buffers of %d kB)", bufferCount, m_buffersize>>10); for (int i=0; i <= bufferCount; ++i) { if (m_buffer_use_histogram[i] != 0) eDebug(" %2d: %6d", i, m_buffer_use_histogram[i]); } if (m_overflow_count) { eDebug("[eDVBRecordFileThread] Demux buffer overflows: %d", m_overflow_count); } if (m_fd_dest >= 0) { posix_fadvise(m_fd_dest, 0, 0, POSIX_FADV_DONTNEED); } }