Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ internal enum ContinuationFlags
ContinueOnThreadPool = 1 << 0,
ContinueOnCapturedSynchronizationContext = 1 << 1,
ContinueOnCapturedTaskScheduler = 1 << 2,
// This is an await of valueTask.AsTask() (e.g. valueTask.AsTask()
// returned from an async version). This flag affects how
// ValueTaskSourceContinuation handling computes the flags to pass to
// IValueTaskSource.OnCompleted.
ValueTaskAdaptedToTask = 1 << 3,

AllContinuationFlags = ContinueOnThreadPool | ContinueOnCapturedSynchronizationContext | ContinueOnCapturedTaskScheduler,

Comment thread
jakobbotsch marked this conversation as resolved.
Expand Down Expand Up @@ -832,7 +837,8 @@ internal unsafe bool HandleSuspended(ref RuntimeAsyncAwaitState state)
// the direct AsyncHelpers.Await(ValueTask/ValueTask<T>) path.
// In either case, that can only happen in nontransparent/user code.
Continuation contWithContinueFlags = valueTaskSourceCont;
while ((contWithContinueFlags.Flags & ContinuationFlags.AllContinuationFlags) == 0 && contWithContinueFlags.Next != null)
while ((contWithContinueFlags.Flags & (ContinuationFlags.AllContinuationFlags | ContinuationFlags.ValueTaskAdaptedToTask)) == 0 &&
contWithContinueFlags.Next != null)
{
contWithContinueFlags = contWithContinueFlags.Next;
}
Expand Down
3 changes: 3 additions & 0 deletions src/coreclr/inc/corinfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -1786,6 +1786,9 @@ enum CorInfoContinuationFlags
// If this bit is set the continuation context is a TaskScheduler that
// we should continue on.
CORINFO_CONTINUATION_CONTINUE_ON_CAPTURED_TASK_SCHEDULER = 1 << 2,
// If this bit is set this is an await of valueTask.AsTask()
// (common pattern when returning a value-task in an async version)
CORINFO_CONTINUATION_VALUETASK_ADAPTED_TO_TASK = 1 << 3,

// The flags encode where in the continuation various members are stored.
// If the encoded index is 0, it means no such member is present.
Expand Down
Loading
Loading