[PERF] Async Background Work Lanes for Assets and FS
This commit is contained in:
@@ -150,11 +150,11 @@ impl AsyncWorkCancelToken {
|
||||
}
|
||||
|
||||
pub fn cancel(&self) {
|
||||
self.canceled.store(true, Ordering::Release);
|
||||
self.canceled.store(true, Ordering::Relaxed);
|
||||
}
|
||||
|
||||
pub fn is_canceled(&self) -> bool {
|
||||
self.canceled.load(Ordering::Acquire)
|
||||
self.canceled.load(Ordering::Relaxed)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -277,11 +277,13 @@ impl AsyncWorkLane {
|
||||
|
||||
pub fn request_cancel(&self, job_id: AsyncWorkJobId) -> bool {
|
||||
let state = self.state.lock().unwrap();
|
||||
if state.active.is_some_and(|active| active.id == job_id) {
|
||||
if let Some(token) = &state.active_cancel_token {
|
||||
token.cancel();
|
||||
return true;
|
||||
}
|
||||
if let Some(token) = state
|
||||
.active
|
||||
.filter(|active| active.id == job_id)
|
||||
.and(state.active_cancel_token.as_ref())
|
||||
{
|
||||
token.cancel();
|
||||
return true;
|
||||
}
|
||||
|
||||
for pending in &state.pending {
|
||||
|
||||
Reference in New Issue
Block a user