async

package
v0.0.0-...-110d06e Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2024 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

View Source
var ExceptionHandler = func(err interface{}) {
	log.Panicln(err)
}

ExceptionHandler 自定义的错误处理程序

Functions

func Go

func Go(f func())

Go 异步函数

Example
package main

import (
	"fmt"
	"time"

	"github.com/hollson/gdk/async"
)

func main() {
	async.ExceptionHandler = func(err interface{}) {
		fmt.Printf(" ❌ goroutine error: %v\n", err)
	}

	async.Go(func() {
		panic("some panic")
	})

	time.Sleep(time.Second)

}
Output:

❌ goroutine error: some panic

Types

This section is empty.

Jump to

Keyboard shortcuts

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