rksm / hot-lib-reloader-rs

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

fix how we lock the lib loader #12

Closed rksm closed 1 year ago

rksm commented 1 year 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).