generated from WebAssembly/wasi-proposal-template
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Define types and functions in the proposal's template (#26)
- Loading branch information
Showing
4 changed files
with
64 additions
and
63 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Types | ||
|
||
## <a href="#thread_spawn_result" name="thread_spawn_result"></a> `thread-spawn-result`: `s32` | ||
|
||
The result of the `thread-spawn()` function. | ||
If spawning the thread was successful, the value is positive | ||
and represents a unique thread identifier. Otherwise, the | ||
value is negative and it represents error code. | ||
|
||
Size: 4, Alignment: 4 | ||
|
||
## <a href="#start_arg" name="start_arg"></a> `start-arg`: `u32` | ||
|
||
A reference to data passed to the start function (`wasi_thread_start()`) called by the newly spawned thread. | ||
|
||
Size: 4, Alignment: 4 | ||
|
||
# Functions | ||
|
||
---- | ||
|
||
#### <a href="#thread_spawn" name="thread_spawn"></a> `thread-spawn` | ||
|
||
Creates a new thread. | ||
##### Params | ||
|
||
- <a href="#thread_spawn.start_arg" name="thread_spawn.start_arg"></a> `start-arg`: [`start-arg`](#start_arg) | ||
##### Results | ||
|
||
- [`thread-spawn-result`](#thread_spawn_result) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# WASI threads API | ||
|
||
WASI threads is an API for thread creation. | ||
|
||
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. | ||
|
||
|
||
## thread-id | ||
|
||
```wit | ||
/// The result of the `thread-spawn()` function. | ||
/// If spawning the thread was successful, the value is positive | ||
/// and represents a unique thread identifier. Otherwise, the | ||
/// value is negative and it represents error code. | ||
type thread-spawn-result = s32 | ||
``` | ||
|
||
## start-arg | ||
|
||
```wit | ||
/// A reference to data passed to the start function (`wasi_thread_start()`) called by the newly spawned thread. | ||
type start-arg = u32 | ||
``` | ||
|
||
## thread_spawn | ||
|
||
```wit | ||
/// Creates a new thread. | ||
thread-spawn: func( | ||
/// A value being passed to a start function (`wasi_thread_start()`). | ||
start-arg: start-arg, | ||
) -> thread-spawn-result | ||
``` |