sync

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package sync provides bindings for Go's sync package and concurrency primitives.

Index

Constants

This section is empty.

Variables

View Source
var Types []byte

Functions

func BindMutex

func BindMutex(vm *goja.Runtime, mu *sync.RWMutex, el *eventloop.EventLoop) goja.Value

BindMutex creates a JavaScript object exposing mutex operations.

func Register

func Register(vm *goja.Runtime, el *eventloop.EventLoop)

Register injects the sync functions into the runtime

Types

type AsyncMutex

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

AsyncMutex wraps a sync.RWMutex with async-friendly locking operations.

func NewAsyncMutex

func NewAsyncMutex(mu *sync.RWMutex, el *eventloop.EventLoop) *AsyncMutex

NewAsyncMutex creates an AsyncMutex wrapping the given RWMutex.

func (*AsyncMutex) Lock

func (m *AsyncMutex) Lock(vm *goja.Runtime) goja.Value

Lock acquires an exclusive write lock asynchronously.

func (*AsyncMutex) RLock

func (m *AsyncMutex) RLock(vm *goja.Runtime) goja.Value

RLock acquires a shared read lock asynchronously.

func (*AsyncMutex) RUnlock

func (m *AsyncMutex) RUnlock()

RUnlock releases a previously acquired read lock.

func (*AsyncMutex) Unlock

func (m *AsyncMutex) Unlock()

Unlock releases a previously acquired write lock.

type Module

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

Module implements the go:sync package bindings.

func (*Module) Sleep

func (m *Module) Sleep(call goja.FunctionCall) goja.Value

func (*Module) Spawn

func (m *Module) Spawn(call goja.FunctionCall) goja.Value

Jump to

Keyboard shortcuts

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