Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 0 additions & 31 deletions proposal-template.abi.md

This file was deleted.

32 changes: 0 additions & 32 deletions proposal-template.wit.md

This file was deleted.

31 changes: 31 additions & 0 deletions wasi-threads.abi.md
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)

40 changes: 40 additions & 0 deletions wasi-threads.wit.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# 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
/// Unique thread identifier.
type thread-id = u32
```

## 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
```

## errno

```wit
/// Error codes returned by the `thread-spawn` function.
enum errno {
/// TBD
eagain,
}
```

## 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,
) -> result<thread-id, errno>
```