ctxlock

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package ctxlock provides cancellation-aware serialization for invocation sinks.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Mutex

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

Mutex is a zero-value-ready mutex. It must not be copied after first use. Callers must check ctx.Err after checking terminal state and before starting effects.

func (*Mutex) Lock

func (m *Mutex) Lock(ctx context.Context) error

Lock acquires the mutex or returns the contended caller's context error. A successful acquisition returns nil even if ctx is canceled, so the caller can preserve terminal-error precedence while holding the mutex.

func (*Mutex) Unlock

func (m *Mutex) Unlock()

Unlock releases a held mutex. It panics if the mutex is not locked.

Jump to

Keyboard shortcuts

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