looper

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package looper provides Go bindings for Android ALooper.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PollOnce

func PollOnce(timeout time.Duration, outFd *int32, outEvents *int32, outData *unsafe.Pointer) int32

PollOnce calls the underlying C function.

func Run

func Run(fn func(*Looper))

Run locks the current goroutine to its OS thread, prepares a new looper, and calls fn with it. The looper is closed when fn returns.

Types

type Error

type Error int32

Error represents an NDK error code.

func (Error) Error

func (e Error) Error() string

type Event

type Event int32
const (
	EventInput   Event = 1
	EventOutput  Event = 2
	EventError   Event = 4
	EventHangup  Event = 8
	EventInvalid Event = 16
)

type LOOPER_POLL

type LOOPER_POLL int32
const (
	ALOOPER_POLL_WAKE     LOOPER_POLL = -1
	ALOOPER_POLL_CALLBACK LOOPER_POLL = -2
	ALOOPER_POLL_TIMEOUT  LOOPER_POLL = -3
	ALOOPER_POLL_ERROR    LOOPER_POLL = -4
)

type LOOPER_PREPARE_ALLOW

type LOOPER_PREPARE_ALLOW int32
const (
	ALOOPER_PREPARE_ALLOW_NON_CALLBACKS LOOPER_PREPARE_ALLOW = 1
)

type Looper

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

Looper wraps the NDK ALooper handle.

func ALooper_forThread

func ALooper_forThread() *Looper

ALooper_forThread calls the underlying C function.

func NewLooperFromPointer

func NewLooperFromPointer(ptr unsafe.Pointer) *Looper

NewLooperFromPointer wraps a raw ALooper pointer.

func Prepare

func Prepare(opts int32) *Looper

Prepare calls the underlying C function.

func (*Looper) Acquire

func (h *Looper) Acquire()

Acquire calls the underlying NDK function.

func (*Looper) Close

func (h *Looper) Close() error

Close releases the underlying NDK handle.

func (*Looper) Pointer

func (h *Looper) Pointer() unsafe.Pointer

Pointer returns the underlying pointer as unsafe.Pointer.

func (*Looper) RemoveFd

func (h *Looper) RemoveFd(fd int32) error

RemoveFd calls the underlying NDK function.

func (*Looper) Wake

func (h *Looper) Wake()

Wake calls the underlying NDK function.

Jump to

Keyboard shortcuts

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