VecSequence: fix reset
update length in reset
This commit is contained in:
parent
687936b098
commit
0f21a6dcd6
1 changed files with 9 additions and 0 deletions
|
@ -64,7 +64,16 @@ where T: Clone + Send + Sync + 'static {
|
|||
fn reset(&mut self, view: Option<Arc<RwLock<Vec<T>>>>) {
|
||||
let old_len = self.len().unwrap();
|
||||
self.data = view;
|
||||
|
||||
*self.cur_len.write().unwrap() =
|
||||
if let Some(data) = self.data.as_ref() {
|
||||
data.read().unwrap().len()
|
||||
} else {
|
||||
0
|
||||
};
|
||||
|
||||
let new_len = self.len().unwrap();
|
||||
|
||||
self.cast.notify_each(0 .. std::cmp::max(old_len, new_len));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue