diff options
Diffstat (limited to 'zluda/src/impl/context.rs')
-rw-r--r-- | zluda/src/impl/context.rs | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/zluda/src/impl/context.rs b/zluda/src/impl/context.rs index 5ef427e..9ea0874 100644 --- a/zluda/src/impl/context.rs +++ b/zluda/src/impl/context.rs @@ -257,9 +257,14 @@ pub fn detach(pctx: *mut Context) -> Result<(), CUresult> { })? } -pub(crate) fn synchronize() -> CUresult { - // TODO: change the implementation once we do async stream operations - CUresult::CUDA_SUCCESS +pub(crate) fn synchronize() -> Result<(), CUresult> { + GlobalState::lock_current_context(|ctx| { + ctx.default_stream.synchronize()?; + for stream in ctx.streams.iter().copied() { + unsafe { &mut *stream }.synchronize()?; + } + Ok(()) + })? } #[cfg(test)] |