poll

package
v0.0.0-...-bc518a9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 14, 2024 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package poll represents the imported interface "wasi:io/poll@0.2.0".

A poll API intended to let users wait for I/O events on multiple handles at once.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Poll

func Poll(in cm.List[Pollable]) (result cm.List[uint32])

Poll represents the imported function "poll".

Poll for completion on a set of pollables.

This function takes a list of pollables, which identify I/O sources of interest, and waits until one or more of the events is ready for I/O.

The result `list<u32>` contains one or more indices of handles in the argument list that is ready for I/O.

If the list contains more elements than can be indexed with a `u32` value, this function traps.

A timeout can be implemented by adding a pollable from the wasi-clocks API to the list.

This function does not return a `result`; polling in itself does not do any I/O so it doesn't fail. If any of the I/O sources identified by the pollables has an error, it is indicated by marking the source as being reaedy for I/O.

poll: func(in: list<borrow<pollable>>) -> list<u32>

Types

type Pollable

type Pollable cm.Resource

Pollable represents the imported resource "wasi:io/poll@0.2.0#pollable".

`pollable` represents a single I/O event which may be ready, or not.

resource pollable

func (Pollable) Block

func (self Pollable) Block()

Block represents the imported method "block".

`block` returns immediately if the pollable is ready, and otherwise blocks until ready.

This function is equivalent to calling `poll.poll` on a list containing only this pollable.

block: func()

func (Pollable) Ready

func (self Pollable) Ready() (result bool)

Ready represents the imported method "ready".

Return the readiness of a pollable. This function never blocks.

Returns `true` when the pollable is ready, and `false` otherwise.

ready: func() -> bool

func (Pollable) ResourceDrop

func (self Pollable) ResourceDrop()

ResourceDrop represents the imported resource-drop for resource "pollable".

Drops a resource handle.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL