ghook

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2025 License: MIT Imports: 7 Imported by: 2 modules, 2 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Demo

hook package does prevent your program main function to exit when all your worker code in goroutine.

package hook

import (
	"github.com/snail007/gmc/process/hook"
)

func main() {
	//your business code here
	
	ghook.RegistShutdown(func() {
		//do something before program exit
	})
    //this will waiting for singal, prevent program main function to exit
	ghook.WaitShutdown()
}

Documentation

Overview

Package ghook package does prevent your program main function to exit when all your worker code in goroutine.

Example
//the code block should be last in your main function code

RegistShutdown(func() {
	//do something before program exit
})
WaitShutdown()

Index

Examples

Constants

This section is empty.

Variables

View Source
var (
	IsMock = false
)

Functions

func MockShutdown

func MockShutdown()

MockShutdown just for testing

func RegistShutdown

func RegistShutdown(fn func())

func WaitShutdown

func WaitShutdown()

Types

This section is empty.

Jump to

Keyboard shortcuts

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