Buffered I(Async)Enumerable #60295
Replies: 4 comments
-
Otherwise, the static IEnumerable<int> LockAndEnumerate<T>(object syncObj, IEnumerator<T> e)
{
while (true)
{
T current;
lock (syncObj)
{
if (!e.MoveNext()) break;
current = e.Current;
}
yield return current;
}
} |
Beta Was this translation helpful? Give feedback.
-
Thanks @stephentoub . I don't think that
|
Beta Was this translation helpful? Give feedback.
-
Oh, and for clarity, in the example above:
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Are there any wrapper classes that allow to to concurrently enumerate over an enumerable from multiple threads but In such a way that the enumerable is only ever enumerated once?
Beta Was this translation helpful? Give feedback.
All reactions