Skip to content

Commit 9572d7a

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

File tree

4 files changed

+80
-63
lines changed

4 files changed

+80
-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: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
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="#start_arg" name="start_arg"></a> `start-arg`: `u32`
10+
11+
A reference to data passed to the start function (`wasi_thread_start()`) called by the newly spawned thread.
12+
13+
Size: 4, Alignment: 4
14+
15+
## <a href="#errno" name="errno"></a> `errno`: enum
16+
17+
Error codes returned by the `thread-spawn` function.
18+
19+
Size: 1, Alignment: 1
20+
21+
### Enum Cases
22+
23+
- <a href="errno.eagain" name="errno.eagain"></a> [`eagain`](#errno.eagain)
24+
25+
TBD
26+
27+
# Functions
28+
29+
----
30+
31+
#### <a href="#thread_spawn" name="thread_spawn"></a> `thread-spawn`
32+
33+
Creates a new thread.
34+
##### Params
35+
36+
- <a href="#thread_spawn.start_arg" name="thread_spawn.start_arg"></a> `start-arg`: [`start-arg`](#start_arg)
37+
##### Results
38+
39+
- result<[`thread-id`](#thread_id), [`errno`](#errno)>
40+

wasi-threads.wit.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# WASI threads API
2+
3+
WASI threads is an API for thread creation.
4+
5+
Its 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+
type start-arg = u32
20+
```
21+
22+
## errno
23+
24+
```wit
25+
/// Error codes returned by the `thread-spawn` function.
26+
enum errno {
27+
/// TBD
28+
eagain,
29+
}
30+
```
31+
32+
## thread_spawn
33+
34+
```wit
35+
/// Creates a new thread.
36+
thread-spawn: func(
37+
/// A value being passed to a start function (`wasi_thread_start()`).
38+
start-arg: start-arg,
39+
) -> result<thread-id, errno>
40+
```

0 commit comments

Comments
 (0)