You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Updates for producer-side. Loopback mapping renamed. Unifying startup/shutdown on both client and server pipe interfaces. IAE<T> helpers for test or some consumers. Producer methods and wiring. Adding default for some protocol.data parameters - empty data is legal for many frames. Test updates (some failing, but interim commit).
// public async Task<T> ExecuteAsync(CancellationToken cancellation = default)
82
+
// {
83
+
// var receiver = new Receiver();
84
+
// await Subscriber(receiver);
85
+
// var result = await receiver.Awaitable;
86
+
// return Mapper((result.data, result.metadata));
87
+
// }
88
+
89
+
// public async Task<T> ExecuteAsync(T result, CancellationToken cancellation = default)
90
+
// {
91
+
// var receiver = new Receiver();
92
+
// await Subscriber(receiver);
93
+
// return result;
94
+
// }
95
+
96
+
// public IAsyncEnumerator<T> GetAsyncEnumerator(CancellationToken cancellation = default)
97
+
// {
98
+
// var enumerator = new MappedEnumerator(Mapper);
99
+
// Subscriber(enumerator); //TODO Do we want to use this task too? It could fault. Also, cancellation. Nope, this should only await on the first MoveNext, so subscription is lower.
100
+
// return enumerator;
101
+
// }
102
+
103
+
// private class Enumerator : IAsyncEnumerator<(ReadOnlySequence<byte> metadata, ReadOnlySequence<byte> data)>, IRSocketStream
// public void OnNext((ReadOnlySequence<byte> metadata, ReadOnlySequence<byte> data) value)
138
+
// {
139
+
// //TODO Would we really need to interlock this? If the Queue isn't allocated, it's the first time through...?
140
+
// //var value = Interlocked.Exchange<(ReadOnlySequence<byte> metadata, ReadOnlySequence<byte> data)>(ref Value, default); //TODO Hmmm, no ValueTuples... Could save Queue allocation if only going to get one...
141
+
// Queue.Enqueue(value);
142
+
// Continue.Set();
143
+
// }
144
+
145
+
// class AsyncManualResetEvent //Steven Toub: https://blogs.msdn.microsoft.com/pfxteam/2012/02/11/building-async-coordination-primitives-part-1-asyncmanualresetevent/
146
+
// {
147
+
// private volatile TaskCompletionSource<bool> Completion = new TaskCompletionSource<bool>();
148
+
// public Task WaitAsync() => Completion.Task;
149
+
// public void Set() { Completion.TrySetResult(true); }
150
+
// public void Reset() { while (true) { var previous = Completion; if (!previous.Task.IsCompleted || Interlocked.CompareExchange(ref Completion, new TaskCompletionSource<bool>(), previous) == previous) { return; } } }
151
+
// }
152
+
// }
153
+
154
+
// private class MappedEnumerator : Enumerator, IAsyncEnumerator<T>, IRSocketStream
0 commit comments