Check for termination status AFTER awaking up, rather than BEFORE going to sleep.

This commit is contained in:
Jonathan Moore Liles 2008-05-01 06:35:11 -05:00
parent 821a3feedc
commit 1b51531bc5
1 changed files with 6 additions and 3 deletions

View File

@ -58,6 +58,8 @@ protected:
volatile nframes_t _pending_seek; /* absolute transport position to seek to */ volatile nframes_t _pending_seek; /* absolute transport position to seek to */
volatile int _terminate; volatile int _terminate;
volatile int _xruns;
int channels ( void ) const { return _rb.size(); } int channels ( void ) const { return _rb.size(); }
Audio_Sequence * track ( void ); Audio_Sequence * track ( void );
@ -69,14 +71,13 @@ protected:
void block_processed ( void ) { sem_post( &_blocks ); } void block_processed ( void ) { sem_post( &_blocks ); }
bool wait_for_block ( void ) bool wait_for_block ( void )
{ {
while ( sem_wait( &_blocks ) == EINTR );
if ( _terminate ) if ( _terminate )
return false; return false;
else else
{
while ( sem_wait( &_blocks ) == EINTR );
return true; return true;
} }
}
virtual void disk_thread ( void ) = 0; virtual void disk_thread ( void ) = 0;
@ -86,6 +87,8 @@ public:
static float seconds_to_buffer; static float seconds_to_buffer;
static size_t disk_io_kbytes; static size_t disk_io_kbytes;
int xruns ( void ) { return _xruns; }
Disk_Stream ( Track *th, float frame_rate, nframes_t nframes, int channels ); Disk_Stream ( Track *th, float frame_rate, nframes_t nframes, int channels );
virtual ~Disk_Stream ( ); virtual ~Disk_Stream ( );