From 434e42851cc347e00db86d02edcddf8412513e75 Mon Sep 17 00:00:00 2001 From: tw Date: Fri, 28 Nov 2025 11:59:26 +0800 Subject: [PATCH 1/2] Add methods related to coroutine id --- base.rfc | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/base.rfc b/base.rfc index 5a7fcbe..fced25f 100644 --- a/base.rfc +++ b/base.rfc @@ -118,6 +118,21 @@ namespace Async { * Represents a coroutine - an executable unit that can be suspended and resumed */ final class Coroutine implements FutureLike { + /** + * Return the coroutine id + */ + public function getId(): int {} + + /** + * Static method get + */ + public static function get ( int $id ) : ?static + + /** + * Static method getCurrent + */ + public static function getCurrent ( ) : self|static + /** * Request cancellation of this coroutine */ From 88f33b2a064b3f2b094c636760df983353f57ba8 Mon Sep 17 00:00:00 2001 From: tw Date: Fri, 28 Nov 2025 13:48:54 +0800 Subject: [PATCH 2/2] Add methods related to coroutine id --- base.rfc | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/base.rfc b/base.rfc index fced25f..3532024 100644 --- a/base.rfc +++ b/base.rfc @@ -112,6 +112,11 @@ namespace Async { */ function getCoroutines(): array {} + /** + * Returns the coroutine by id + */ + function getCoroutine( int $id ): ?Coroutine {} + // === Core Classes === /** @@ -119,20 +124,10 @@ namespace Async { */ final class Coroutine implements FutureLike { /** - * Return the coroutine id + * Returns the coroutine id */ public function getId(): int {} - /** - * Static method get - */ - public static function get ( int $id ) : ?static - - /** - * Static method getCurrent - */ - public static function getCurrent ( ) : self|static - /** * Request cancellation of this coroutine */