Skip to content

Commit

Permalink
Fix AwaitableSocketAsyncEventArgs reorderings on weaker memory models (
Browse files Browse the repository at this point in the history
…#50624)

* Fix AwaitableSocketAsyncEventArgs reorderings on weaker memory models

* add comment
  • Loading branch information
antonfirsov authored Sep 13, 2023
1 parent 3ddde39 commit ecea5b9
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@ internal class SocketAwaitableEventArgs : SocketAsyncEventArgs, IValueTaskSource

private readonly PipeScheduler _ioScheduler;

private Action<object?>? _continuation;
// There are places where we read the _continuation field and then read some other state which we assume to be consistent
// with the value we read in _continuation. Without a fence, those secondary reads could be reordered with respect to the first.
// https://github.com/dotnet/runtime/pull/84432
// https://github.com/dotnet/aspnetcore/issues/50623
private volatile Action<object?>? _continuation;

public SocketAwaitableEventArgs(PipeScheduler ioScheduler)
: base(unsafeSuppressExecutionContextFlow: true)
Expand Down

0 comments on commit ecea5b9

Please sign in to comment.