Browse Source

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

tags/non-daw-v1.1.0
Jonathan Moore Liles 17 years ago
parent
commit
1b51531bc5
1 changed files with 6 additions and 3 deletions
  1. +6
    -3
      Timeline/Disk_Stream.H

+ 6
- 3
Timeline/Disk_Stream.H 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,13 +71,12 @@ 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 ( );


Loading…
Cancel
Save