mirror of https://github.com/Cysharp/UniTask
Compare commits
2 Commits
0c0a742bbf
...
55bc644563
Author | SHA1 | Date |
---|---|---|
|
55bc644563 | |
|
bd0fe8e77d |
|
@ -2,12 +2,7 @@
|
||||||
using FluentAssertions;
|
using FluentAssertions;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Channels;
|
|
||||||
using Cysharp.Threading.Tasks.Linq;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace NetCoreTests
|
namespace NetCoreTests
|
||||||
|
|
|
@ -42,7 +42,6 @@ namespace Cysharp.Threading.Tasks
|
||||||
while (h != null)
|
while (h != null)
|
||||||
{
|
{
|
||||||
iteratingNode = h;
|
iteratingNode = h;
|
||||||
var next = h.Next;
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -54,7 +53,9 @@ namespace Cysharp.Threading.Tasks
|
||||||
Remove(h);
|
Remove(h);
|
||||||
}
|
}
|
||||||
|
|
||||||
h = next;
|
// If `h` itself is removed by OnNext, h.Next is null.
|
||||||
|
// Therefore, instead of looking at h.Next, the `iteratingNode` reference itself is replaced.
|
||||||
|
h = h == iteratingNode ? h.Next : iteratingNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
iteratingNode = null;
|
iteratingNode = null;
|
||||||
|
@ -238,17 +239,19 @@ namespace Cysharp.Threading.Tasks
|
||||||
{
|
{
|
||||||
head = next;
|
head = next;
|
||||||
}
|
}
|
||||||
else if (handler == iteratingHead)
|
|
||||||
{
|
|
||||||
iteratingHead = next;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// when handler is head, prev indicate last so don't use it.
|
// when handler is head, prev indicate last so don't use it.
|
||||||
if (prev != null)
|
else if (prev != null)
|
||||||
{
|
{
|
||||||
prev.Next = next;
|
prev.Next = next;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (handler == iteratingNode)
|
||||||
|
{
|
||||||
|
iteratingNode = next;
|
||||||
|
}
|
||||||
|
if (handler == iteratingHead)
|
||||||
|
{
|
||||||
|
iteratingHead = next;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (head != null)
|
if (head != null)
|
||||||
|
|
Loading…
Reference in New Issue