monitor

package
v0.0.0-...-8fa2440 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2016 License: MIT Imports: 0 Imported by: 0

Documentation

Overview

Package monitor provides utilities for launching goroutines and being informed when they exit.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Monitor

func Monitor(f func() error) <-chan Event

Runs a function in a goroutine. When the goroutine exits, send a single event on the returned channel.

Types

type Event

type Event struct {
	Type  EventType
	Panic interface{} // If the goroutine panicked, this is the panic value.
	Error error       // The value returned by the function.
}

A goroutine monitoring event.

type EventType

type EventType int
const (
	NormalExit  EventType = iota // The goroutine exited normally.
	PanicExit                    // The goroutine panicked.
	RuntimeExit                  // The goroutine was terminated via runtime.Goexit().
)

Jump to

Keyboard shortcuts

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