mirror of
https://github.com/BililiveRecorder/BililiveRecorder.git
synced 2024-11-15 19:22:19 +08:00
Toolbox: Fix race condition by using lock
This commit is contained in:
parent
32d49c70fc
commit
209fb8c45c
|
@ -35,9 +35,12 @@ namespace BililiveRecorder.ToolBox.Tool.DanmakuStartTime
|
|||
{
|
||||
var el = (XNode.ReadFrom(r) as XElement)!;
|
||||
var time = (DateTimeOffset)el.Attribute("start_time");
|
||||
result.Add(new DanmakuStartTimeResponse.DanmakuStartTime { Path = input, StartTime = time });
|
||||
|
||||
lock (result)
|
||||
result.Add(new DanmakuStartTimeResponse.DanmakuStartTime { Path = input, StartTime = time });
|
||||
|
||||
Interlocked.Increment(ref finished);
|
||||
|
||||
progress?.Invoke(finished / total);
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user