mirror of
https://github.com/librespot-org/librespot.git
synced 2025-10-06 03:50:06 +02:00
Improve lock ordering and contention
This commit is contained in:
parent
5c2b5a21c1
commit
1a7c440bd7
6 changed files with 82 additions and 48 deletions
|
@ -1,11 +1,10 @@
|
|||
use std::{
|
||||
cmp::{max, min},
|
||||
io::{Seek, SeekFrom, Write},
|
||||
sync::{atomic, Arc},
|
||||
sync::{atomic::Ordering, Arc},
|
||||
time::{Duration, Instant},
|
||||
};
|
||||
|
||||
use atomic::Ordering;
|
||||
use bytes::Bytes;
|
||||
use futures_util::StreamExt;
|
||||
use hyper::StatusCode;
|
||||
|
@ -231,7 +230,7 @@ impl AudioFileFetch {
|
|||
|
||||
// download data from after the current read position first
|
||||
let mut tail_end = RangeSet::new();
|
||||
let read_position = self.shared.read_position.load(Ordering::Relaxed);
|
||||
let read_position = self.shared.read_position.load(Ordering::Acquire);
|
||||
tail_end.add_range(&Range::new(
|
||||
read_position,
|
||||
self.shared.file_size - read_position,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue