Skip to content

Commit 12c643e

Browse files
committed
Define types and functions in the proposal's template
1 parent 4a9776c commit 12c643e

File tree

4 files changed

+64
-63
lines changed

4 files changed

+64
-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: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Types
2+
3+
## <a href="#thread_spawn_result" name="thread_spawn_result"></a> `thread-spawn-result`: `s32`
4+
5+
The result of the `thread-spawn()` function.
6+
If spawning the thread was successful, the value is positive
7+
and represents a unique thread identifier. Otherwise, the
8+
value is negative and it represents error code.
9+
10+
Size: 4, Alignment: 4
11+
12+
## <a href="#start_arg" name="start_arg"></a> `start-arg`: `u32`
13+
14+
A reference to data passed to the start function (`wasi_thread_start()`) called by the newly spawned thread.
15+
16+
Size: 4, Alignment: 4
17+
18+
# Functions
19+
20+
----
21+
22+
#### <a href="#thread_spawn" name="thread_spawn"></a> `thread-spawn`
23+
24+
Creates a new thread.
25+
##### Params
26+
27+
- <a href="#thread_spawn.start_arg" name="thread_spawn.start_arg"></a> `start-arg`: [`start-arg`](#start_arg)
28+
##### Results
29+
30+
- [`thread-spawn-result`](#thread_spawn_result)
31+

wasi-threads.wit.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
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+
/// The result of the `thread-spawn()` function.
12+
/// If spawning the thread was successful, the value is positive
13+
/// and represents a unique thread identifier. Otherwise, the
14+
/// value is negative and it represents error code.
15+
type thread-spawn-result = s32
16+
```
17+
18+
## start-arg
19+
20+
```wit
21+
/// A reference to data passed to the start function (`wasi_thread_start()`) called by the newly spawned thread.
22+
type start-arg = u32
23+
```
24+
25+
## thread_spawn
26+
27+
```wit
28+
/// Creates a new thread.
29+
thread-spawn: func(
30+
/// A value being passed to a start function (`wasi_thread_start()`).
31+
start-arg: start-arg,
32+
) -> thread-spawn-result
33+
```

0 commit comments

Comments
 (0)