chore(napi): add Send and Sync to Reference (#2007)

This commit is contained in:
LongYinan 2024-03-20 22:30:45 +08:00 committed by GitHub
parent 4719caa643
commit 13651c5ff1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -29,6 +29,9 @@ pub struct Reference<T: 'static> {
finalize_callbacks: Rc<Cell<*mut dyn FnOnce()>>,
}
unsafe impl<T: Send> Send for Reference<T> {}
unsafe impl<T: Sync> Sync for Reference<T> {}
impl<T> Drop for Reference<T> {
fn drop(&mut self) {
let rc_strong_count = Rc::strong_count(&self.finalize_callbacks);