diff --git a/src/whisper_ctx.rs b/src/whisper_ctx.rs index f5e9f33..7c3ee96 100644 --- a/src/whisper_ctx.rs +++ b/src/whisper_ctx.rs @@ -453,3 +453,9 @@ impl Drop for WhisperContext { 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 {} diff --git a/src/whisper_params.rs b/src/whisper_params.rs index fb06b4d..7d36c78 100644 --- a/src/whisper_params.rs +++ b/src/whisper_params.rs @@ -112,3 +112,9 @@ impl<'a> FullParams<'a> { 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> {}