From 1b51531bc5fd5e7bce8a9355e9f46bc469d7b036 Mon Sep 17 00:00:00 2001 From: Jonathan Moore Liles Date: Thu, 1 May 2008 06:35:11 -0500 Subject: [PATCH] Check for termination status AFTER awaking up, rather than BEFORE going to sleep. --- Timeline/Disk_Stream.H | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Timeline/Disk_Stream.H b/Timeline/Disk_Stream.H index e310bf2..0a3b2ae 100644 --- a/Timeline/Disk_Stream.H +++ b/Timeline/Disk_Stream.H @@ -58,6 +58,8 @@ protected: volatile nframes_t _pending_seek; /* absolute transport position to seek to */ volatile int _terminate; + volatile int _xruns; + int channels ( void ) const { return _rb.size(); } Audio_Sequence * track ( void ); @@ -69,13 +71,12 @@ protected: void block_processed ( void ) { sem_post( &_blocks ); } bool wait_for_block ( void ) { + while ( sem_wait( &_blocks ) == EINTR ); + if ( _terminate ) return false; else - { - while ( sem_wait( &_blocks ) == EINTR ); return true; - } } virtual void disk_thread ( void ) = 0; @@ -86,6 +87,8 @@ public: static float seconds_to_buffer; static size_t disk_io_kbytes; + int xruns ( void ) { return _xruns; } + Disk_Stream ( Track *th, float frame_rate, nframes_t nframes, int channels ); virtual ~Disk_Stream ( );