Documentation ¶
Index ¶
- Constants
- Variables
- func AllocConsole(args ...string)
- func BytesToPointer(b []byte) unsafe.Pointer
- func CPtrToBytes(ptr unsafe.Pointer, l int) []byte
- func CPtrToString(ptr unsafe.Pointer, maxLen ...int) string
- func CString(name string) *byte
- func Callback(arg1 *C.void, arg2 *C.void, arg3 *C.void, arg4 *C.void, arg5 *C.void, ...) *C.void
- func CopyDir(srcPath string, dstPath string) error
- func CopyFile(dest, src string) error
- func CopyFile2(dstName, srcName string) error
- func DefaultDaemon() bool
- func DefaultDog(logFile string) bool
- func ErrToFile(filename string, mutiFile ...bool) bool
- func FileExist(filename string) bool
- func FileExist2(filename string) (bool, bool)
- func FormatDir(dir string) string
- func FormatDirRoot(rootDir, dir string) string
- func FreeConsole()
- func GetCallFunctionName(depth int) string
- func GetCallInfo(depth int) string
- func GetFileName(filename string) string
- func GetFilePath(filename string) string
- func GetFuncInfo(v interface{}) (name string, file string, line int)
- func GetFuncName(f interface{}) string
- func Go(f interface{}, loop bool, arg ...interface{})
- func GoBytes(c uintptr, l int) []byte
- func GoExit()
- func GoID() int
- func GoString(c unsafe.Pointer) string
- func HideConsole() uint64
- func IsFileValid(f *os.File) bool
- func IsNil(i interface{}) bool
- func IsSameType(t1, t2 reflect.Type) bool
- func KillOneThread()
- func ListenSignal(callback func(s os.Signal), signals []os.Signal)
- func Mkdir(path string) string
- func MoveFile(dest, src string) error
- func NewCallback(fn interface{}) uintptr
- func NewSysProcAttr(arg map[string]interface{}) *syscall.SysProcAttr
- func OnPanic(logFile bool)
- func RandShort() string
- func RandomUint32() uint32
- func RecoverFunc(file string, line int, errSave ...bool)
- func ReopenStdout()
- func SetConsoleTitle(text string)
- func SetProcessName(name string) error
- func SetPts(pts_dev string) bool
- func ShowConsole() uint64
- func ShowMessage(title, text string, parent ...uintptr)
- func StringToPointer(str string) unsafe.Pointer
- func ULimit(max, cur int) error
- func ULimitGet() (int, int, error)
- type Channel
- type DogCallback
- type GoRoutine
- type GoRoutineManager
- type GoRoutineSlice
- type MutexEx
- func (me *MutexEx) Close()
- func (me *MutexEx) GetCallInfo() (string, int)
- func (me *MutexEx) GetInfo() string
- func (me *MutexEx) GetStatus() int8
- func (me *MutexEx) IsLock() bool
- func (me *MutexEx) Lock()
- func (me *MutexEx) LockInfo(str string)
- func (me *MutexEx) RecordFile(v bool, deepth int)
- func (me *MutexEx) Unlock()
- func (me *MutexEx) UnlockInfo(str string)
- type ProcCallback
- type ProcInfo
- func (me *ProcInfo) Exit(ret int)
- func (me *ProcInfo) GetCreateTime() int64
- func (me *ProcInfo) GetHandup() bool
- func (me *ProcInfo) GetName() string
- func (me *ProcInfo) GetProcId() int64
- func (me *ProcInfo) GetTick() int64
- func (me *ProcInfo) GetTickInterval() int64
- func (me *ProcInfo) IsExit() bool
- func (me *ProcInfo) Notify(v int)
- func (me *ProcInfo) SetFun(name string, fun ProcCallback)
- func (me *ProcInfo) SetSleepMs(ms int)
- type ProcMgr
- func (me *ProcMgr) CheckProc()
- func (me *ProcMgr) CreateProc(name string, fun ProcCallback, args []interface{}) (*ProcInfo, bool)
- func (me *ProcMgr) CreateProc2(name string, fun ProcCallback, args []interface{}) (*ProcInfo, bool)
- func (me *ProcMgr) EnableCheck(v bool)
- func (me *ProcMgr) ExitAllProcess()
- func (me *ProcMgr) GetFirstProcName() string
- func (me *ProcMgr) GetProcCount() int
- func (me *ProcMgr) GetProcMap() map[int64]*ProcInfo
- func (me *ProcMgr) Lock()
- func (me *ProcMgr) Proc(args []interface{}, procInfo *ProcInfo)
- func (me *ProcMgr) Start(procInfo *ProcInfo)
- func (me *ProcMgr) Unlock()
- func (me *ProcMgr) Wait()
- type ProcessGroup
- type RandEx
- type WatchDog
- func (me *WatchDog) AddEnv(value string)
- func (me *WatchDog) AllocDebugConsole() *os.File
- func (me *WatchDog) IsFileValid(f *os.File) bool
- func (me *WatchDog) RunDaemon(stdout *os.File) error
- func (me *WatchDog) RunWatchDog(errDaemonFile, logPrefix string, stdout *os.File, stdin *os.File, ...) error
- func (me *WatchDog) SetAppFilename(filename string)
- func (me *WatchDog) SetStderr(stderr *os.File)
- func (me *WatchDog) SetStdin(stdin *os.File)
- func (me *WatchDog) SetStdout(stdout *os.File)
Constants ¶
View Source
const SIGCHLD = syscall.Signal(17)
Variables ¶
View Source
var ApplicationFullName string
View Source
var ApplicationName string
View Source
var ApplicationPath string
View Source
var ErrAlreadyDaemon error = errors.New("ErrAlreadyDaemon")
View Source
var ErrAlreadyWatchDog error = errors.New("ErrAlreadyWatchDog")
View Source
var ErrAlreadyWatchDog2 error = errors.New("ErrAlreadyWatchDog2")
View Source
var ErrNotSupportDaemon error = errors.New("ErrNotSupportDaemon")
View Source
var IsCgoEnabled bool
View Source
var MutexMap = xmap.NewMap[int64, *MutexEx]() //map[int64]*MutexEx
Functions ¶
func AllocConsole ¶
func AllocConsole(args ...string)
func BytesToPointer ¶
func DefaultDaemon ¶
func DefaultDaemon() bool
func DefaultDog ¶
func FileExist2 ¶
func FormatDirRoot ¶
func FreeConsole ¶
func FreeConsole()
func GetCallFunctionName ¶
func GetCallInfo ¶
func GetFileName ¶
func GetFuncInfo ¶
func GetFuncName ¶
func GetFuncName(f interface{}) string
func HideConsole ¶
func HideConsole() uint64
func IsFileValid ¶
func IsSameType ¶
func KillOneThread ¶
func KillOneThread()
func NewCallback ¶
func NewCallback(fn interface{}) uintptr
func NewSysProcAttr ¶
func NewSysProcAttr(arg map[string]interface{}) *syscall.SysProcAttr
func RandomUint32 ¶
func RandomUint32() uint32
func RecoverFunc ¶
func ReopenStdout ¶
func ReopenStdout()
func SetConsoleTitle ¶
func SetConsoleTitle(text string)
func ShowConsole ¶
func ShowConsole() uint64
func ShowMessage ¶
func StringToPointer ¶
Types ¶
type Channel ¶
type Channel struct {
// contains filtered or unexported fields
}
func NewChannel ¶
func (*Channel) SetWaitClose ¶
type DogCallback ¶
type DogCallback func(restart *bool)
type GoRoutine ¶
type GoRoutineManager ¶
type GoRoutineManager struct {
// contains filtered or unexported fields
}
func (*GoRoutineManager) Add ¶
func (r *GoRoutineManager) Add(callInfo string) *GoRoutine
func (*GoRoutineManager) Count ¶
func (r *GoRoutineManager) Count() int
func (*GoRoutineManager) Del ¶
func (r *GoRoutineManager) Del(id int64)
func (*GoRoutineManager) DumpGo ¶
func (r *GoRoutineManager) DumpGo() []*GoRoutine
func (*GoRoutineManager) Exit ¶
func (r *GoRoutineManager) Exit()
func (*GoRoutineManager) Go ¶
func (r *GoRoutineManager) Go(f interface{}, loop bool, arg ...interface{})
type GoRoutineSlice ¶
type GoRoutineSlice []*GoRoutine
func (GoRoutineSlice) Len ¶
func (g GoRoutineSlice) Len() int
func (GoRoutineSlice) Less ¶
func (g GoRoutineSlice) Less(i, j int) bool
func (GoRoutineSlice) Swap ¶
func (g GoRoutineSlice) Swap(i, j int)
type MutexEx ¶
func (*MutexEx) GetCallInfo ¶
func (*MutexEx) RecordFile ¶
func (*MutexEx) UnlockInfo ¶
type ProcCallback ¶
type ProcCallback func(args []interface{}, procInfo *ProcInfo)
type ProcInfo ¶
type ProcInfo struct { Wg *sync.WaitGroup //用于多个go 同步 SyncCh chan int //用于多个go 同步 // contains filtered or unexported fields }
func (*ProcInfo) GetCreateTime ¶
func (*ProcInfo) GetTickInterval ¶
func (*ProcInfo) SetFun ¶
func (me *ProcInfo) SetFun(name string, fun ProcCallback)
func (*ProcInfo) SetSleepMs ¶
type ProcMgr ¶
type ProcMgr struct { Id int64 // contains filtered or unexported fields }
///////////////////////////////ProcMgr///////////////////////////////////////
var Process *ProcMgr
func NewProcMgr ¶
func NewProcMgr() *ProcMgr
func (*ProcMgr) CreateProc ¶
func (me *ProcMgr) CreateProc(name string, fun ProcCallback, args []interface{}) (*ProcInfo, bool)
callback:
func Callback(args []interface{}, procInfo *goapi.ProcInfo){ if me.bExit == false { }else{ procInfo.Exit(1) } }
func (*ProcMgr) CreateProc2 ¶
func (me *ProcMgr) CreateProc2(name string, fun ProcCallback, args []interface{}) (*ProcInfo, bool)
不立即执行
func (*ProcMgr) EnableCheck ¶
func (*ProcMgr) ExitAllProcess ¶
func (me *ProcMgr) ExitAllProcess()
func (*ProcMgr) GetFirstProcName ¶
func (*ProcMgr) GetProcCount ¶
func (*ProcMgr) GetProcMap ¶
type ProcessGroup ¶
type ProcessGroup struct {
// contains filtered or unexported fields
}
func ProcessGroupNew ¶
func ProcessGroupNew() *ProcessGroup
func (*ProcessGroup) Add ¶
func (me *ProcessGroup) Add(proc *ProcInfo)
func (*ProcessGroup) Stop ¶
func (me *ProcessGroup) Stop()
type WatchDog ¶
type WatchDog struct {
// contains filtered or unexported fields
}
func NewWatchDog ¶
func NewWatchDog() *WatchDog
func (*WatchDog) AllocDebugConsole ¶
func (*WatchDog) RunWatchDog ¶
func (me *WatchDog) RunWatchDog(errDaemonFile, logPrefix string, stdout *os.File, stdin *os.File, callback ...DogCallback) error
die loop
func (*WatchDog) SetAppFilename ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.