Skip to content

Commit be604f6

Browse files
committed
Define types and functions in the proposal's template
1 parent 9d4364b commit be604f6

File tree

4 files changed

+75
-63
lines changed

4 files changed

+75
-63
lines changed

proposal-template.abi.md

Lines changed: 0 additions & 31 deletions
This file was deleted.

proposal-template.wit.md

Lines changed: 0 additions & 32 deletions
This file was deleted.

wasi-threads.abi.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Types
2+
3+
## <a href="#thread_id" name="thread_id"></a> `thread-id`: `u32`
4+
5+
Unique thread identifier.
6+
7+
Size: 4, Alignment: 4
8+
9+
## <a href="#errno" name="errno"></a> `errno`: enum
10+
11+
Error codes returned by the `thread-spawn` function.
12+
13+
Size: 1, Alignment: 1
14+
15+
### Enum Cases
16+
17+
- <a href="errno.eagain" name="errno.eagain"></a> [`eagain`](#errno.eagain)
18+
19+
TBD
20+
21+
# Functions
22+
23+
----
24+
25+
#### <a href="#thread_spawn" name="thread_spawn"></a> `thread-spawn`
26+
27+
Creates a new thread.
28+
##### Params
29+
30+
- <a href="#thread_spawn.start_arg" name="thread_spawn.start_arg"></a> `start-arg`: handle<start-arg>
31+
##### Results
32+
33+
- result<[`thread-id`](#thread_id), [`errno`](#errno)>
34+

wasi-threads.wit.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# WASI threads API
2+
3+
WASI threads is an API for thread creation.
4+
5+
It's goal is to provide functions that allow implementation of a subset of `pthreads` API, but it doesn't aim to be 100% compatible with POSIX threads standard.
6+
7+
8+
## thread-id
9+
10+
```wit
11+
/// Unique thread identifier.
12+
type thread-id = u32
13+
```
14+
15+
## start-arg
16+
17+
```wit
18+
/// A reference to data passed to the start function (`wasi_thread_start()`) called by the newly spawned thread.
19+
resource start-arg {
20+
}
21+
```
22+
23+
## errno
24+
25+
```wit
26+
/// Error codes returned by the `thread-spawn` function.
27+
enum errno {
28+
/// TBD
29+
eagain,
30+
}
31+
```
32+
33+
## thread_spawn
34+
35+
```wit
36+
/// Creates a new thread.
37+
thread-spawn: func(
38+
/// A value being passed to a start function (`wasi_thread_start()`).
39+
start-arg: start-arg,
40+
) -> result<thread-id, errno>
41+
```

0 commit comments

Comments
 (0)