This commit is contained in:
azw 2023-08-20 17:55:06 +08:00
parent 32124c9aa4
commit d9013f408e
2 changed files with 12 additions and 1 deletions

12
app.go
View File

@ -86,6 +86,12 @@ func (this *app) init(userApp UserApp) {
this.loopCond = sync.NewCond(new(sync.Mutex))
this.chGoLoopTimerExit = make(chan int)
this.chGoLoopWait = make(chan int64)
_app.RegisterIMMsgHandle(
IM_EXEC_MAIN_THREAD_CB,
func (args q5.Args) {
cb := args[0].(func ())
cb()
})
this.outputRuningLog()
GetSysLog().Info("node_id:%d instance_id:%d pid:%d",
this.nodeId,
@ -172,7 +178,11 @@ func (this *app) RegisterIMMsgHandle(msgId uint16, handle func(q5.Args)) {
this.imMsgHandlers[msgId] = handle
}
func (this *app) RegisterMainThreadCb(func ()) {
func (this *app) RegisterMainThreadCb(cb func ()) {
_app.AddIMMsg(IM_EXEC_MAIN_THREAD_CB,
[]interface{} {
cb,
})
}
func (this *app) goLoopTimer() {

View File

@ -2,6 +2,7 @@ package f5
const (
IM_HTTP_CLI_MGR_RESPONSE = 1
IM_EXEC_MAIN_THREAD_CB = iota
)
const (