-
Notifications
You must be signed in to change notification settings - Fork 874
Expand file tree
/
Copy pathManualResetValueTaskSource.cs
More file actions
21 lines (17 loc) · 1.02 KB
/
ManualResetValueTaskSource.cs
File metadata and controls
21 lines (17 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
using System;
using System.Threading.Tasks.Sources;
namespace Npgsql.Util;
sealed class ManualResetValueTaskSource<T> : IValueTaskSource<T>, IValueTaskSource
{
ManualResetValueTaskSourceCore<T> _core; // mutable struct; do not make this readonly
public bool RunContinuationsAsynchronously { get => _core.RunContinuationsAsynchronously; set => _core.RunContinuationsAsynchronously = value; }
public short Version => _core.Version;
public void Reset() => _core.Reset();
public void SetResult(T result) => _core.SetResult(result);
public void SetException(Exception error) => _core.SetException(error);
public T GetResult(short token) => _core.GetResult(token);
void IValueTaskSource.GetResult(short token) => _core.GetResult(token);
public ValueTaskSourceStatus GetStatus(short token) => _core.GetStatus(token);
public void OnCompleted(Action<object?> continuation, object? state, short token, ValueTaskSourceOnCompletedFlags flags)
=> _core.OnCompleted(continuation, state, token, flags);
}