diff --git a/dar2oar_core/src/fs/converter/parallel.rs b/dar2oar_core/src/fs/converter/parallel.rs index e66a348..9b98b4b 100644 --- a/dar2oar_core/src/fs/converter/parallel.rs +++ b/dar2oar_core/src/fs/converter/parallel.rs @@ -77,10 +77,12 @@ pub async fn convert_dar_to_oar( progress_fn(idx); } - if is_converted_once.load(Ordering::Acquire) { - handle_conversion_results(hide_dar, &dar_namespace, &dar_1st_namespace).await - } else { - Err(ConvertError::NeverConverted) + // # Ordering validity: + // Since all processing threads are loaded after they have finished, ordering relationships are not a concern. + // Therefore, there is no problem in using `Relaxed`. + match is_converted_once.load(Ordering::Relaxed) { + true => handle_conversion_results(hide_dar, &dar_namespace, &dar_1st_namespace).await, + false => Err(ConvertError::NeverConverted), } } diff --git a/dar2oar_core/src/fs/converter/sequential.rs b/dar2oar_core/src/fs/converter/sequential.rs index 44f1aaa..d97c682 100644 --- a/dar2oar_core/src/fs/converter/sequential.rs +++ b/dar2oar_core/src/fs/converter/sequential.rs @@ -56,10 +56,12 @@ pub async fn convert_dar_to_oar( idx += 1; } - if is_converted_once.load(Ordering::Acquire) { - handle_conversion_results(hide_dar, &dar_namespace, &dar_1st_namespace).await - } else { - Err(ConvertError::NeverConverted) + // # Ordering validity: + // The order is irrelevant because `tokio::spawn` is not used in the while loop. + // Therefore, there is no problem in using `Relaxed`. + match is_converted_once.load(Ordering::Relaxed) { + true => handle_conversion_results(hide_dar, &dar_namespace, &dar_1st_namespace).await, + false => Err(ConvertError::NeverConverted), } }