{
// TODO: take care of boundaries.
int w = write(m_fd_dest, m_buffer + m_buf_start, m_buf_end - m_buf_start);
+ eDebug("wrote %d bytes", w);
if (w <= 0)
{
if (errno == -EINTR)
// ... we would stop the thread
}
+ /* this should flush all written pages to disk. */
posix_fadvise(m_fd_dest, dest_pos, w, POSIX_FADV_DONTNEED);
dest_pos += w;
{
m_fd_source = fd_source;
m_fd_dest = fd_dest;
- m_stop = 0;
- run();
+ resume();
}
void eFilePushThread::stop()
sendSignal(SIGUSR1);
kill();
}
+
+void eFilePushThread::pause()
+{
+ stop();
+}
+
+void eFilePushThread::seek(off_t where)
+{
+ ::lseek(m_fd_source, where, SEEK_SET);
+}
+
+void eFilePushThread::resume()
+{
+ m_stop = 0;
+ run();
+}
#define __lib_base_filepush_h
#include <lib/base/thread.h>
+#include <sys/types.h>
class eFilePushThread: public eThread
{
void thread();
void stop();
void start(int sourcefd, int destfd);
+
+ void pause();
+ void seek(off_t where);
+ void resume();
+
private:
int m_stop;
unsigned char m_buffer[65536];