Skip to content

Commit

Permalink
Added thread access validation in PromiseMethodBuilders.
Browse files Browse the repository at this point in the history
  • Loading branch information
timcassell committed Oct 28, 2020
1 parent 5445182 commit 2b8e92a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 0 additions & 2 deletions Promises/Extensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ public static async Promise ToPromise(this Task task)
{
// No thread safety in the Promise library yet, so try to force continuation on main thread.
// User must call this method from the main thread in order for this to work.
ValidateThreadAccess(1);
await task.ConfigureAwait(true);
}

Expand All @@ -55,7 +54,6 @@ public static async Promise<T> ToPromise<T>(this Task<T> task)
{
// No thread safety in the Promise library yet, so try to force continuation on main thread.
// User must call this method from the main thread in order for this to work.
ValidateThreadAccess(1);
return await task.ConfigureAwait(true);
}
#endif
Expand Down
2 changes: 2 additions & 0 deletions Promises/Internal/AsyncAwaitInternal.cs
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,7 @@ protected override void Dispose()
[DebuggerHidden]
public static PromiseMethodBuilder Create()
{
Internal.ValidateThreadAccess(1);
return new PromiseMethodBuilder()
{
_promise = AsyncPromise.GetOrCreate()
Expand Down Expand Up @@ -494,6 +495,7 @@ protected override void Dispose()
[DebuggerHidden]
public static PromiseMethodBuilder<T> Create()
{
Internal.ValidateThreadAccess(1);
return new PromiseMethodBuilder<T>()
{
_promise = AsyncPromise.GetOrCreate()
Expand Down

0 comments on commit 2b8e92a

Please sign in to comment.