hadronized / warmy

Hot-reloading loadable and reloadable resources
Other
215 stars 14 forks source link

Swap `Mutex` for `RwLock` or even `AtomicRefCell` #38

Open sdleffler opened 4 years ago

sdleffler commented 4 years ago

Heya! So, I wanted to use this with some stuff that wants Send + Sync and I looked in and saw that currently warmy uses a Arc<Mutex> pattern for that which doesn't mesh with the same borrowing rules as Rc<RefCell>. However, there's a crate I like called atomic_refcell which provides a RefCell-like type that is Sync; would you be open to swapping out Mutex for AtomicRefCell? And if not, then maybe std::sync::RwLock since it also, like RefCell, allows many readers or 1 writer rather than just 1 lock holder.