eventfd

package
v0.0.0-...-8940ca0 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2023 License: Apache-2.0, MIT Imports: 6 Imported by: 0

Documentation

Overview

Package eventfd wraps Linux's eventfd(2) syscall.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Eventfd

type Eventfd struct {
	// contains filtered or unexported fields
}

Eventfd represents a Linux eventfd object.

func Create

func Create() (Eventfd, error)

Create returns an initialized eventfd.

func Wrap

func Wrap(fd int) Eventfd

Wrap returns an initialized Eventfd using the provided fd.

func (Eventfd) Close

func (ev Eventfd) Close() error

Close closes the eventfd, after which it should not be used.

func (Eventfd) Dup

func (ev Eventfd) Dup() (Eventfd, error)

Dup copies the eventfd, calling dup(2) on the underlying file descriptor.

func (Eventfd) FD

func (ev Eventfd) FD() int

FD returns the underlying file descriptor. Use with care, as this breaks the Eventfd abstraction.

func (Eventfd) Notify

func (ev Eventfd) Notify() error

Notify alerts other users of the eventfd. Users can receive alerts by calling Wait or Read.

func (Eventfd) Read

func (ev Eventfd) Read() (uint64, error)

Read blocks until eventfd is non-zero (i.e. someone calls Notify or Write) and returns the value read.

func (Eventfd) Wait

func (ev Eventfd) Wait() error

Wait blocks until eventfd is non-zero (i.e. someone calls Notify or Write).

func (Eventfd) Write

func (ev Eventfd) Write(val uint64) error

Write writes a specific value to the eventfd.

Jump to

Keyboard shortcuts

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