Skip to content

Commit dbb86ce

Browse files
authored
Update approved API in runtime-async spec (#115181)
1 parent 2677261 commit dbb86ce

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

docs/design/specs/runtime-async.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,12 @@ Async methods support suspension using one of the following methods:
3434
```C#
3535
namespace System.Runtime.CompilerServices
3636
{
37-
public static class RuntimeHelpers
37+
public static class AsyncHelpers
3838
{
3939
[MethodImpl(MethodImplOptions.Async)]
40-
public static void AwaitAwaiterFromRuntimeAsync<TAwaiter>(TAwaiter awaiter) where TAwaiter : INotifyCompletion { ... }
40+
public static void AwaitAwaiter<TAwaiter>(TAwaiter awaiter) where TAwaiter : INotifyCompletion;
4141
[MethodImpl(MethodImplOptions.Async)]
42-
public static void UnsafeAwaitAwaiterFromRuntimeAsync<TAwaiter>(TAwaiter awaiter) where TAwaiter : ICriticalNotifyCompletion
42+
public static void UnsafeAwaitAwaiter<TAwaiter>(TAwaiter awaiter) where TAwaiter : ICriticalNotifyCompletion;
4343

4444
[MethodImpl(MethodImplOptions.Async)]
4545
public static void Await(Task task);
@@ -62,7 +62,7 @@ Async methods support suspension using one of the following methods:
6262
}
6363
```
6464

65-
These methods are only legal to call inside async methods. The `...AwaitAwaiter...` methods will have semantics analogous to the current `AsyncTaskMethodBuilder.AwaitOnCompleted/AwaitUnsafeOnCompleted` methods. After calling either method, it can be presumed that the task or awaiter has completed. The `Await` methods perform suspension like the `AwaitAwaiter...` methods, but are optimized for calling on the return value of a call to an async method. To achieve maximum performance, the IL sequence of two `call` instructions -- one to the async method and immediately one to the `Await` method -- should be preferred.
65+
These methods are only legal to call inside async methods. The `...AwaitAwaiter` methods will have semantics analogous to the current `AsyncTaskMethodBuilder.AwaitOnCompleted/AwaitUnsafeOnCompleted` methods. After calling either method, it can be presumed that the task or awaiter has completed. The `Await` methods perform suspension like the `...AwaitAwaiter` methods, but are optimized for calling on the return value of a call to an async method. To achieve maximum performance, the IL sequence of two `call` instructions -- one to the async method and immediately one to the `Await` method -- should be preferred.
6666

6767
Local variables used across suspension points are considered "hoisted." That is, only "hoisted" local variables will have their state preserved after returning from a suspension. By-ref variables may not be hoisted across suspension points, and any read of a by-ref variable after a suspension point will produce null. Structs containing by-ref variables will also not be hoisted across suspension points and will have their default value after a suspension point.
6868
In the same way, pinning locals may not be "hoisted" across suspension points and will have `null` value after a suspension point.

0 commit comments

Comments
 (0)