Skip to content

Commit

Permalink
Define types and functions in the proposal's template
Browse files Browse the repository at this point in the history
  • Loading branch information
loganek committed Jan 9, 2023
1 parent 9d4364b commit be604f6
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 63 deletions.
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.

34 changes: 34 additions & 0 deletions wasi-threads.abi.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Types

## <a href="#thread_id" name="thread_id"></a> `thread-id`: `u32`

Unique thread identifier.

Size: 4, Alignment: 4

## <a href="#errno" name="errno"></a> `errno`: enum

Error codes returned by the `thread-spawn` function.

Size: 1, Alignment: 1

### Enum Cases

- <a href="errno.eagain" name="errno.eagain"></a> [`eagain`](#errno.eagain)

TBD

# 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`: handle<start-arg>
##### Results

- result<[`thread-id`](#thread_id), [`errno`](#errno)>

41 changes: 41 additions & 0 deletions wasi-threads.wit.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# WASI threads API

WASI threads is an API for thread creation.

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.


## 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.
resource start-arg {
}
```

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

0 comments on commit be604f6

Please sign in to comment.