summaryrefslogtreecommitdiff
path: root/tools/backgroundwriter.c
diff options
context:
space:
mode:
authorphintuka <phintuka>2009-09-13 12:53:26 +0000
committerphintuka <phintuka>2009-09-13 12:53:26 +0000
commit4ac531b577521f181e8a942c1f9ffb6ebf8504d1 (patch)
treedb8f05e67b2acc7b08fce5c35e48d0f6e2942a2b /tools/backgroundwriter.c
parent0c654b8f2951c46d3176056d46c7afe93e4b6326 (diff)
downloadxineliboutput-unlabeled-1.13.2.tar.gz
xineliboutput-unlabeled-1.13.2.tar.bz2
Merge revision 1.16unlabeled-1.13.2
Replaced m_Active with cThread::Running() and cThread::Cancel()
Diffstat (limited to 'tools/backgroundwriter.c')
-rw-r--r--tools/backgroundwriter.c24
1 files changed, 10 insertions, 14 deletions
diff --git a/tools/backgroundwriter.c b/tools/backgroundwriter.c
index d9a446d0..392b9969 100644
--- a/tools/backgroundwriter.c
+++ b/tools/backgroundwriter.c
@@ -4,7 +4,7 @@
* See the main source file 'xineliboutput.c' for copyright information and
* how to reach the author.
*
- * $Id: backgroundwriter.c,v 1.13 2009-07-21 11:06:35 phintuka Exp $
+ * $Id: backgroundwriter.c,v 1.13.2.1 2009-09-13 12:53:26 phintuka Exp $
*
*/
@@ -39,7 +39,6 @@ cBackgroundWriterI::cBackgroundWriterI(int fd, int Size, int Margin)
{
m_fd = fd;
m_RingBuffer.SetTimeouts(0, 100);
- m_Active = true;
m_PutPos = 0;
m_DiscardStart = 0;
@@ -74,7 +73,6 @@ cBackgroundWriterI::cBackgroundWriterI(int fd, int Size, int Margin)
cBackgroundWriterI::~cBackgroundWriterI()
{
- m_Active = false;
Cancel(3);
}
@@ -120,7 +118,7 @@ bool cBackgroundWriterI::Flush(int TimeoutMs)
WaitEnd += (uint64_t)TimeoutMs;
while(cTimeMs::Now() < WaitEnd &&
- m_Active &&
+ Running() &&
m_RingBuffer.Available() > 0)
cCondWait::SleepMs(3);
}
@@ -152,7 +150,7 @@ void cTcpWriter::Action(void)
uint64_t GetPos = 0;
cPoller Poller (m_fd, true);
- while(m_Active) {
+ while (Running()) {
if(Poller.Poll(100)) {
@@ -224,7 +222,6 @@ void cTcpWriter::Action(void)
}
m_RingBuffer.Clear();
- m_Active = false;
}
int cTcpWriter::Put(uint64_t StreamPos,
@@ -239,7 +236,7 @@ int cTcpWriter::Put(uint64_t StreamPos,
int cTcpWriter::Put(const uchar *Header, int HeaderCount,
const uchar *Data, int DataCount)
{
- if(m_Active) {
+ if (Running()) {
// Serialize Put access to keep Data and Header together
LOCK_THREAD;
@@ -249,7 +246,7 @@ int cTcpWriter::Put(const uchar *Header, int HeaderCount,
if(m_BufferOverflows++ > MAX_OVERFLOWS_BEFORE_DISCONNECT) {
LOGMSG("cXinelibServer: Too many TCP buffer overflows, dropping client");
m_RingBuffer.Clear();
- m_Active = false;
+ Cancel(-1);
return 0;
}
return -HeaderCount-DataCount;
@@ -264,7 +261,7 @@ int cTcpWriter::Put(const uchar *Header, int HeaderCount,
LOGMSG("cXinelibServer: TCP buffer internal error ?!?");
m_RingBuffer.Clear();
- m_Active = false;
+ Cancel(-1);
}
return 0;
@@ -288,7 +285,7 @@ void cRawWriter::Action(void)
uint64_t GetPos = 0ULL;
cPoller Poller(m_fd, true);
- while(m_Active) {
+ while (Running()) {
if(Poller.Poll(100)) {
@@ -358,13 +355,12 @@ void cRawWriter::Action(void)
}
m_RingBuffer.Clear();
- m_Active = false;
}
int cRawWriter::Put(uint64_t StreamPos,
const uchar *Data, int DataCount)
{
- if(m_Active) {
+ if (Running()) {
// Serialize Put access to keep Data and Header together
LOCK_THREAD;
@@ -373,7 +369,7 @@ int cRawWriter::Put(uint64_t StreamPos,
if(m_BufferOverflows++ > MAX_OVERFLOWS_BEFORE_DISCONNECT) {
LOGMSG("cXinelibServer: Too many TCP buffer overflows, dropping client");
m_RingBuffer.Clear();
- m_Active = false;
+ Cancel(-1);
return 0;
}
return -DataCount;
@@ -387,7 +383,7 @@ int cRawWriter::Put(uint64_t StreamPos,
LOGMSG("cXinelibServer: TCP buffer internal error ?!?");
m_RingBuffer.Clear();
- m_Active = false;
+ Cancel(-1);
}
return 0;