diff --git a/rust/src/zstdmt_compress.rs b/rust/src/zstdmt_compress.rs index 7fc871940..188741fe8 100644 --- a/rust/src/zstdmt_compress.rs +++ b/rust/src/zstdmt_compress.rs @@ -133,7 +133,10 @@ pub unsafe extern "C" fn ZSTDMT_rust_serialStateWaitForTurn( unsafe { lock(state.callback_context); - while *state.next_job_id < state.job_id { + loop { + if *state.next_job_id >= state.job_id { + break; + } wait(state.callback_context); } c_int::from(*state.next_job_id == state.job_id)