add Send and Sync impls
This commit is contained in:
parent
60d22b0330
commit
d2e48983b9
2 changed files with 12 additions and 0 deletions
|
|
@ -453,3 +453,9 @@ impl Drop for WhisperContext {
|
||||||
unsafe { whisper_rs_sys::whisper_free(self.ctx) };
|
unsafe { whisper_rs_sys::whisper_free(self.ctx) };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// following implementations are safe
|
||||||
|
// see https://github.com/ggerganov/whisper.cpp/issues/32#issuecomment-1272790388
|
||||||
|
// concurrent usage is prevented by &mut self on methods that modify the struct
|
||||||
|
unsafe impl Send for WhisperContext {}
|
||||||
|
unsafe impl Sync for WhisperContext {}
|
||||||
|
|
|
||||||
|
|
@ -112,3 +112,9 @@ impl<'a> FullParams<'a> {
|
||||||
self.fp.language = language.as_ptr() as *const _;
|
self.fp.language = language.as_ptr() as *const _;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// following implementations are safe
|
||||||
|
// see https://github.com/ggerganov/whisper.cpp/issues/32#issuecomment-1272790388
|
||||||
|
// concurrent usage is prevented by &mut self on methods that modify the struct
|
||||||
|
unsafe impl<'a> Send for FullParams<'a> {}
|
||||||
|
unsafe impl<'a> Sync for FullParams<'a> {}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue