mirror of
https://github.com/mpv-player/mpv
synced 2025-01-09 00:19:32 +00:00
cache: avoid race condition between cache wakeup and idling
When the reader is out of data, it tries to wake up the cache thread to get more data. In theory, there's a small race condition, which could cause the cache to miss the wakeup and idle before reaction. Most certainly didn't cause real issues, because even if this extremely unlikely race condition happens, the cache won't idle for longer than 1 second (the hardcoded cache idle time).
This commit is contained in:
parent
eca0fcb77a
commit
ae1b1a68cb
@ -567,6 +567,7 @@ static int cache_fill_buffer(struct stream *cache, char *buffer, int max_len)
|
||||
break;
|
||||
if (s->eof && s->read_filepos >= s->max_filepos && s->reads >= retry)
|
||||
break;
|
||||
s->idle = false;
|
||||
if (cache_wakeup_and_wait(s, &retry_time) == CACHE_INTERRUPTED)
|
||||
break;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user