File tree Expand file tree Collapse file tree 2 files changed +43
-5
lines changed
Expand file tree Collapse file tree 2 files changed +43
-5
lines changed Original file line number Diff line number Diff line change 1+
2+ import std.sys { System { todo } }
3+
4+ module File {
5+ function new() = todo("Implement the file functions")
6+ }
7+
8+
Original file line number Diff line number Diff line change 11
2-
2+ // Module: Virtual
3+ // Contains functions for working with threads
34module Virtual {
4- function task(fx) = pic_nat_task(fx)
5- function sleep(fx) = pic_nat_sleep(fx)
6- function await(task) = task.await
7- }
85
6+ // Function: task
7+ // Executes a closure in a virtual thread
8+ //
9+ // Parameters:
10+ // fx - The closure to execute
11+ //
12+ // Returns:
13+ // A handle to the thread executing.
14+ // This handle can be used to get the result of the closure
15+ function task(fx) = pic_nat_task(fx)
16+
17+
18+ // Function: sleep
19+ // Pauses the current thread
20+ //
21+ // Parameters:
22+ // ms - Amount to pause by, in milliseconds
23+ //
24+ // Returns:
25+ // A Unit value
26+ function sleep(ms) = pic_nat_sleep(ms)
27+
28+
29+ // Function: await
30+ // Waits for the virtual thread to finish and gets the result
31+ //
32+ // Parameters:
33+ // task - The task handle
34+ //
35+ // Returns:
36+ // The result of the thread.
37+ function await(task) = task.await
38+ }
939
1040
You can’t perform that action at this time.
0 commit comments