From 4f524eff68ca42db36ad899febdd8f8ea8cde863 Mon Sep 17 00:00:00 2001 From: Kenneth Skovhede Date: Fri, 15 Aug 2025 10:29:15 +0200 Subject: [PATCH] Fixed increment without lock --- .../Library/Main/Operation/Restore/FileProcessor.cs | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/Duplicati/Library/Main/Operation/Restore/FileProcessor.cs b/Duplicati/Library/Main/Operation/Restore/FileProcessor.cs index 72bcbc60f..f1177e31b 100644 --- a/Duplicati/Library/Main/Operation/Restore/FileProcessor.cs +++ b/Duplicati/Library/Main/Operation/Restore/FileProcessor.cs @@ -56,13 +56,9 @@ namespace Duplicati.Library.Main.Operation.Restore public static object file_processor_continue_lock = new object(); public static TaskCompletionSource file_processor_continue = new(); /// - /// Lock for the file processor ID. - /// - public static object id_lock = new(); - /// /// The current file processor ID. Used for debugging. /// - public static int id = 0; + private static int processor_id = 0; /// /// Runs the file processor process that restores the files that need to be restored. @@ -102,11 +98,7 @@ namespace Duplicati.Library.Main.Operation.Restore // Indicates whether this FileProcessor is still restoring files var decremented = false; // ID for this file processor, used for debugging. - int my_id = -1; - lock (id_lock) - { - my_id = id++; - } + var my_id = Interlocked.Increment(ref processor_id); try {