switch from slab to slotmap for tasks to fix that ABA problem (#2488)

This commit is contained in:
Evan Almloff authored and GitHub committed 2024-06-07 14:36:08 -07:00
1 parent 5024139e01
commit e4764f2bba
5 files changed
+39 -18

No files matched your search

+3 -1
View File
@@ -1,3 +1,5 @@
use slotmap::DefaultKey;
use crate::innerlude::Effect;
use crate::{
innerlude::{LocalTask, SchedulerMsg},
@@ -27,7 +29,7 @@ pub struct Runtime {
pub(crate) current_task: Cell<Option<Task>>,
/// Tasks created with cx.spawn
pub(crate) tasks: RefCell<slab::Slab<Rc<LocalTask>>>,
pub(crate) tasks: RefCell<slotmap::SlotMap<DefaultKey, Rc<LocalTask>>>,
// Currently suspended tasks
pub(crate) suspended_tasks: Cell<usize>,