signal

package
v0.0.0-...-51c1140 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package signal provides helpers to allow worker processes to signal to their progenitors that they are ready to receive connections.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsolateProcessGroup

func IsolateProcessGroup() error

IsolateProcessGroup ensures that the current process is a process group leader.

func ListenForWorker

func ListenForWorker(timeout time.Duration) <-chan WorkerState

ListenForWorker waits for a worker process to send it a signal, then uses that to indicate that the worker is ready. If no signal is received before the timeout duration is hit, then a timeout will be indicated via the WorkerState channel.

Regardless, exactly one message will be sent down the returned channel, after which it will be closed.

func SendReady

func SendReady() error

SendReady sends a signal to the progenitor process that the worker is ready.

Types

type WorkerState

type WorkerState int

The worker state: one of WorkerReady or WorkerTimeout.

const (
	// The state that indicates that the worker is ready to receive connections.
	WorkerReady WorkerState = iota

	// The state indicating that no signal was received before the timeout.
	WorkerTimeout
)

Jump to

Keyboard shortcuts

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