mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-libstb-hal.git
synced 2025-08-26 15:02:43 +02:00
Merge remote-tracking branch 'martiis-libstb-hal/master'
Origin commit data
------------------
Branch: master
Commit: 40461c4cce
Author: max_10 <max_10@gmx.de>
Date: 2014-08-25 (Mon, 25 Aug 2014)
------------------
No further description and justification available within origin commit message!
------------------
This commit was generated by Migit
This commit is contained in:
@@ -23,6 +23,13 @@ void *execute_record_thread(void *c)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void *execute_writer_thread(void *c)
|
||||
{
|
||||
cRecord *obj = (cRecord *)c;
|
||||
obj->WriterThread();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
cRecord::cRecord(int num, int bs_dmx, int bs)
|
||||
{
|
||||
lt_info("%s %d\n", __func__, num);
|
||||
@@ -174,6 +181,32 @@ bool cRecord::AddPid(unsigned short pid)
|
||||
return dmx->addPid(pid);
|
||||
}
|
||||
|
||||
void cRecord::WriterThread()
|
||||
{
|
||||
char threadname[17];
|
||||
strncpy(threadname, "WriterThread", sizeof(threadname));
|
||||
threadname[16] = 0;
|
||||
prctl (PR_SET_NAME, (unsigned long)&threadname);
|
||||
unsigned int chunk = 0;
|
||||
while (!sem_wait(&sem)) {
|
||||
if (!io_len[chunk]) // empty, assume end of recording
|
||||
return;
|
||||
unsigned char *p_buf = io_buf[chunk];
|
||||
size_t p_len = io_len[chunk];
|
||||
while (p_len) {
|
||||
ssize_t written = write(file_fd, p_buf, p_len);
|
||||
if (written < 0)
|
||||
break;
|
||||
p_len -= written;
|
||||
p_buf += written;
|
||||
}
|
||||
if (posix_fadvise(file_fd, 0, 0, POSIX_FADV_DONTNEED))
|
||||
perror("posix_fadvise");
|
||||
chunk++;
|
||||
chunk %= RECORD_WRITER_CHUNKS;
|
||||
}
|
||||
}
|
||||
|
||||
void cRecord::RecordThread()
|
||||
{
|
||||
lt_info("%s: begin\n", __func__);
|
||||
|
Reference in New Issue
Block a user