Commit 6c8cf01d authored by Marc Gravell's avatar Marc Gravell

fix thread-race on _parent

parent b73d231b
......@@ -95,7 +95,7 @@ public async Task PubSubGetAllAnyOrder()
{
data.Add(int.Parse(Encoding.UTF8.GetString(val)));
pulse = data.Count == count;
if ((data.Count % 10) == 99) Output.WriteLine(data.Count.ToString());
if ((data.Count % 100) == 99) Output.WriteLine(data.Count.ToString());
}
if (pulse)
{
......@@ -151,7 +151,7 @@ async Task RunLoop()
{
data.Add(i);
if (data.Count == count) break;
if ((data.Count % 10) == 99) Output.WriteLine(data.Count.ToString());
if ((data.Count % 100) == 99) Output.WriteLine(data.Count.ToString());
}
}
lock (syncLock)
......@@ -210,7 +210,7 @@ public async Task PubSubGetAllCorrectOrder_OnMessage_Sync()
{
data.Add(i);
if (data.Count == count) pulse = true;
if ((data.Count % 10) == 99) Output.WriteLine(data.Count.ToString());
if ((data.Count % 100) == 99) Output.WriteLine(data.Count.ToString());
}
if (pulse)
{
......@@ -271,7 +271,7 @@ public async Task PubSubGetAllCorrectOrder_OnMessage_Async()
{
data.Add(i);
if (data.Count == count) pulse = true;
if ((data.Count % 10) == 99) Output.WriteLine(data.Count.ToString());
if ((data.Count % 100) == 99) Output.WriteLine(data.Count.ToString());
}
if (pulse)
{
......
......@@ -157,7 +157,7 @@ internal void UnsubscribeImpl(Exception error = null, CommandFlags flags = Comma
var parent = _parent;
if (parent != null)
{
_parent.UnsubscribeAsync(_redisChannel, HandleMessage, flags);
parent.UnsubscribeAsync(_redisChannel, HandleMessage, flags);
_parent = null;
_channel.Writer.TryComplete(error);
}
......@@ -167,7 +167,7 @@ internal async Task UnsubscribeAsyncImpl(Exception error = null, CommandFlags fl
var parent = _parent;
if (parent != null)
{
await _parent.UnsubscribeAsync(_redisChannel, HandleMessage, flags);
await parent.UnsubscribeAsync(_redisChannel, HandleMessage, flags);
_parent = null;
_channel.Writer.TryComplete(error);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment