This commit is contained in:
2026-01-25 04:58:39 +01:00
parent 957e3a4762
commit 2e425571ca
139 changed files with 5078 additions and 73 deletions
+22
View File
@@ -0,0 +1,22 @@
// retoor <retoor@molodetz.nl>
import "scheduler" for Scheduler, Future
import "timer" for Timer
System.print("=== Await Demo ===\n")
System.print("--- Basic Await ---")
await Timer.sleep(1)
System.print("Timer completed")
System.print("\n--- Concurrent Async ---")
var task1 = async { Timer.sleep(1) }
var task2 = async { Timer.sleep(1) }
await task1
await task2
System.print("Both tasks completed concurrently")
System.print("\n--- Async With Result ---")
var task = async { "computed value" }
var result = await task
System.print("Result: %(result)")