11#include <QWaitCondition>
28 void run(
void)
override;
39 void run(
void)
override;
53 : m_filename(std::move(fname)), m_flags(flags), m_mode(mode) {}
57 bool ReOpen(
const QString& newFilename =
"");
59 long long Seek(
long long pos,
int whence);
60 int Write(
const void *data,
uint count);
62 void SetWriteBufferMinWriteSize(
uint newMinSize = kMinWriteSize);
64 void Sync(
void)
const;
66 bool SetBlocking(
bool block =
true);
72 void TrimEmptyBuffers(
void);
83 bool m_inDtor {
false};
84 bool m_ignoreWrites {
false};
85 uint m_tfwMinWriteSize {kMinWriteSize};
116 bool m_warned {
false};
117 bool m_blocking {
false};
118 bool m_registered {
false};
This is a wrapper around QThread that does several additional things.
bool wait(std::chrono::milliseconds time=std::chrono::milliseconds::max())
Wait for the MThread to exit, with a maximum timeout.
~TFWSyncThread() override
TFWSyncThread(ThreadedFileWriter *p)
void run(void) override
Runs ThreadedFileWriter::SyncLoop(void)
ThreadedFileWriter * m_parent
void run(void) override
Runs ThreadedFileWriter::DiskLoop(void)
TFWWriteThread(ThreadedFileWriter *p)
~TFWWriteThread() override
ThreadedFileWriter * m_parent
This class supports the writing of recordings to disk.
QWaitCondition m_bufferHasData
QWaitCondition m_bufferEmpty
static const uint kMaxBufferSize
bool WritesFailing(void) const
static const uint kMinWriteSize
Minimum to write to disk in a single write, when not flushing buffer.
ThreadedFileWriter(QString fname, int flags, mode_t mode)
Creates a threaded file writer.
QWaitCondition m_bufferWasFreed
QList< TFWBuffer * > m_emptyBuffers
static const uint kMaxBlockSize
Maximum block size to write at a time.
QList< TFWBuffer * > m_writeBuffers
QWaitCondition m_bufferSyncWait