13
0

reduce another race condition risk

overwrite_queued == true is equivalent to _pending_overwrite != 0
This commit is contained in:
Paul Davis 2019-12-12 12:09:15 -07:00
parent 0b0c415b40
commit bf8c256771
2 changed files with 2 additions and 9 deletions

View File

@ -184,7 +184,6 @@ private:
sampleoffset_t overwrite_offset; sampleoffset_t overwrite_offset;
samplepos_t new_file_sample; samplepos_t new_file_sample;
mutable gint _pending_overwrite; mutable gint _pending_overwrite;
bool overwrite_queued;
bool run_must_resolve; bool run_must_resolve;
IOChange input_change_pending; IOChange input_change_pending;
samplepos_t file_sample[DataType::num_types]; samplepos_t file_sample[DataType::num_types];

View File

@ -60,7 +60,6 @@ samplecnt_t DiskReader::loop_fade_length (0);
DiskReader::DiskReader (Session& s, string const & str, DiskIOProcessor::Flag f) DiskReader::DiskReader (Session& s, string const & str, DiskIOProcessor::Flag f)
: DiskIOProcessor (s, str, f) : DiskIOProcessor (s, str, f)
, overwrite_sample (0) , overwrite_sample (0)
, overwrite_queued (false)
, run_must_resolve (false) , run_must_resolve (false)
, _declick_amp (s.nominal_sample_rate ()) , _declick_amp (s.nominal_sample_rate ())
, _declick_offs (0) , _declick_offs (0)
@ -233,10 +232,7 @@ DiskReader::adjust_buffering ()
void void
DiskReader::playlist_modified () DiskReader::playlist_modified ()
{ {
if (!overwrite_queued) { _session.request_overwrite_buffer (_track, PlaylistModified);
_session.request_overwrite_buffer (_track, PlaylistModified);
overwrite_queued = true;
}
} }
int int
@ -257,9 +253,8 @@ DiskReader::use_playlist (DataType dt, boost::shared_ptr<Playlist> playlist)
take care of the buffer refill. take care of the buffer refill.
*/ */
if (!overwrite_queued && (prior_playlist || _session.loading())) { if ((g_atomic_int_get (&_pending_overwrite) & PlaylistChanged) || prior_playlist) {
_session.request_overwrite_buffer (_track, PlaylistChanged); _session.request_overwrite_buffer (_track, PlaylistChanged);
overwrite_queued = true;
} }
return 0; return 0;
@ -639,7 +634,6 @@ DiskReader::overwrite_existing_buffers ()
} }
} }
overwrite_queued = false;
g_atomic_int_set (&_pending_overwrite, 0); g_atomic_int_set (&_pending_overwrite, 0);
return ret; return ret;