-
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #489 from timcassell/develop
Merge develop
- Loading branch information
Showing
162 changed files
with
11,352 additions
and
5,917 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Change Log | ||
|
||
## v3.2.0 - November 3, 2024 | ||
|
||
Enhancements: | ||
|
||
- Added `Channel<T>` and related types in `Proto.Promises.Channels` namespace. | ||
- Added `Promise(<T>).{ConfigureAwait, ConfigureContinuation}` APIs and accompanying `ContinuationOptions` type. | ||
- Added `SynchronizationOption.CapturedContext` option. | ||
- Added `(Ordered, Configured)AsyncEnumerable.ConfigureAwait(ContinuationOptions)` new overloads. | ||
- Exposed `ConfiguredAsyncEnumerable<T>.{ContinuationOptions, CancelationToken}` and `ConfiguredAsyncEnumerable<T>.Enumerator.ContinuationOptions`. | ||
- Added `ManualSynchronizationContextCore` type. | ||
- Added `PromiseSynchronizationContext.Execute(bool exhaustive)` API. | ||
- Added `Promise(<T>).FromException` API. | ||
- Added option to disable context capture for async synchronization primitives. | ||
|
||
Fixes: | ||
|
||
- Fixed some bugs surrounding `AsyncEnumerable.Merge` enumerator disposal. | ||
- Fixed a potential race condition with `Promise.New` API. | ||
- Fixed some async Linq implementations that weren't configuring the awaits properly. | ||
|
||
Deprecated: | ||
|
||
- Deprecated `Promise(<T>).WaitAsync` APIs accepting `SynchronizationContext` and `SynchronizationOption`. | ||
|
||
Misc: | ||
|
||
- Changed default `Progress` invokeOption to `CapturedContext`. | ||
- Added net8.0 build target. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Channels | ||
|
||
A channel is an async producer/consumer data structure, similar to a blocking collection. You can use it to move data from 1 or more producers to 1 or more consumers asynchronously. Both bounded and unbounded channels are supported. | ||
|
||
`Proto.Promises.Channels.Channel<T>` was designed very similar to `System.Threading.Channels.Channel<T>`. See the [BCL documentation](https://learn.microsoft.com/en-us/dotnet/core/extensions/channels) to see how channels may be typically used. Channels in this library work very similarly, but were also designed to not allocate. When you no longer need the channel, you can `Dispose` it to return the backing object to the pool for future re-use. | ||
|
||
Another difference from the BCL design is, if the channeled objects need to be cleaned up, and you are working with a bounded channel, you can retrieve the dropped item and clean it up, or try to write it to the channel again. `if (channelWriteResult.TryGetDroppedItem(out var droppedItem)) { ... }` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
#if PROTO_PROMISE_DEBUG_ENABLE || (!PROTO_PROMISE_DEBUG_DISABLE && DEBUG) | ||
#define PROMISE_DEBUG | ||
#else | ||
#undef PROMISE_DEBUG | ||
#endif | ||
|
||
using System.Diagnostics; | ||
|
||
namespace Proto.Promises.Channels | ||
{ | ||
/// <summary> | ||
/// Specifies the behavior to use when writing to a bounded channel that is already full. | ||
/// </summary> | ||
public enum BoundedChannelFullMode : byte | ||
{ | ||
/// <summary> | ||
/// Wait for space to be available in order to complete the write operation. | ||
/// </summary> | ||
Wait, | ||
/// <summary> | ||
/// Remove the newest item in the channel in order to make room for the item being written. | ||
/// </summary> | ||
DropNewest, | ||
/// <summary> | ||
/// Remove the oldest item in the channel in order to make room for the item being written. | ||
/// </summary> | ||
DropOldest, | ||
/// <summary> | ||
/// Drop the item being written. | ||
/// </summary> | ||
DropWrite | ||
} | ||
|
||
/// <summary> | ||
/// Provides options that control the behavior of bounded <see cref="Channel{T}"/> instances. | ||
/// </summary> | ||
/// <typeparam name="T">Specifies the type of data that is channeled.</typeparam> | ||
#if !PROTO_PROMISE_DEVELOPER_MODE | ||
[DebuggerNonUserCode, StackTraceHidden] | ||
#endif | ||
public struct BoundedChannelOptions<T> | ||
{ | ||
/// <summary> | ||
/// Gets or sets the maximum number of items the bounded channel may store. | ||
/// </summary> | ||
public int Capacity { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the behavior incurred by write operations when the channel is full. | ||
/// </summary> | ||
public BoundedChannelFullMode FullMode { get; set; } | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.