Open JakkuSakura opened 2 months ago
Interestingly, the ::init function is not mentioned in the example of how to use the scheduler, it gets called implicitly when adding a job. But we don't use atomic swap for writing to inited, just acquire a lock and then write true, so it seems that if someone had a few clones of the JobScheduler (uninitted) and called add on them at the same time, the actors may get started twice. Seems to be likely harmless, though.
Hi, thank's for the effort being done.
Recently, I hit an issue that if
scheduler.spawn()
is called in the code, without actual tasks, my server blocks.I started reviewing code in this crate. I noticed the following points to improve
Arc<Mutex<bool>>
can be written asArc<AtomicBool>
can be replaced with just
tx.send()
can be replaced as
w.take()