summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorphintuka <phintuka>2009-07-21 09:48:35 +0000
committerphintuka <phintuka>2009-07-21 09:48:35 +0000
commit9a04f8df1a7b5c8f32b4a7540d31113f629e2165 (patch)
tree01ad37ce948401ab111e14e8fcf4fb9cac214e8d /tools
parent453ec3c404cf6912756a63b4f606d77a6416ee61 (diff)
downloadxineliboutput-9a04f8df1a7b5c8f32b4a7540d31113f629e2165.tar.gz
xineliboutput-9a04f8df1a7b5c8f32b4a7540d31113f629e2165.tar.bz2
Fixed possible race condition in Flush()
Diffstat (limited to 'tools')
-rw-r--r--tools/backgroundwriter.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/tools/backgroundwriter.c b/tools/backgroundwriter.c
index a4296d91..aa321dd7 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.8 2009-03-18 21:05:26 phintuka Exp $
+ * $Id: backgroundwriter.c,v 1.9 2009-07-21 09:48:35 phintuka Exp $
*
*/
@@ -105,7 +105,8 @@ bool cBackgroundWriterI::Flush(int TimeoutMs)
cCondWait::SleepMs(3);
}
- if(m_IsSocket && m_RingBuffer.Available() <= 0) {
+ int Available = m_RingBuffer.Available();
+ if(m_IsSocket && Available <= 0) {
// flush corked data too
#if defined(TCP_CORK)
int i = 1;
@@ -122,8 +123,8 @@ bool cBackgroundWriterI::Flush(int TimeoutMs)
}
#endif
}
-
- return m_RingBuffer.Available() <= 0;
+
+ return Available <= 0;
}