rksm / hot-lib-reloader-rs

Reload Rust code without app restarts. For faster feedback cycles.
MIT License
618 stars 20 forks source link

fix how we lock the lib loader #12

Closed rksm closed 2 years ago

rksm commented 2 years ago

I used a convoluted half-baked incorrect ref counting scheme for access to symbols while not needing to mutex lock the lib loader during a call (so that recursive calls work)

This is much better addressed with a RwLock that.

This cleans up both the __lib_loader() and __lib_notifier() accessors. It should also fix spurious crashes during hot updates that were likely caused by symbols actually being used (b/c the prev solution wasn't really thread safe).