1
This commit is contained in:
parent
69d556c643
commit
5df419b966
16
app.go
16
app.go
@ -1,9 +1,11 @@
|
|||||||
package f5
|
package f5
|
||||||
|
|
||||||
import "flag"
|
import (
|
||||||
import "sync"
|
"flag"
|
||||||
import "time"
|
"sync"
|
||||||
import "q5"
|
"time"
|
||||||
|
"q5"
|
||||||
|
)
|
||||||
|
|
||||||
type App_ struct {
|
type App_ struct {
|
||||||
nodeId int
|
nodeId int
|
||||||
@ -19,10 +21,12 @@ type App_ struct {
|
|||||||
imWorkNode *IMMsgNode
|
imWorkNode *IMMsgNode
|
||||||
imMsgMutex sync.RWMutex
|
imMsgMutex sync.RWMutex
|
||||||
chGoLoopTimerExit chan int
|
chGoLoopTimerExit chan int
|
||||||
|
nowTime time.Time
|
||||||
imMsgHandlers [1024]func(int16,*q5.XParams)
|
imMsgHandlers [1024]func(int16,*q5.XParams)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *App_) Init() {
|
func (this *App_) Init() {
|
||||||
|
this.nowTime = time.Now()
|
||||||
_Timer = &q5.Timer{}
|
_Timer = &q5.Timer{}
|
||||||
_Timer.Init(
|
_Timer.Init(
|
||||||
func (context interface{}) int64 {
|
func (context interface{}) int64 {
|
||||||
@ -60,6 +64,7 @@ func (this *App_) UnInit() {
|
|||||||
|
|
||||||
func (this *App_) Run() {
|
func (this *App_) Run() {
|
||||||
for !this.terminated {
|
for !this.terminated {
|
||||||
|
this.nowTime = time.Now()
|
||||||
_Timer.Update()
|
_Timer.Update()
|
||||||
this.schedule()
|
this.schedule()
|
||||||
}
|
}
|
||||||
@ -129,3 +134,6 @@ func (this *App_) schedule() {
|
|||||||
this.loopCond.L.Unlock()
|
this.loopCond.L.Unlock()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (this *App_) NowUnix() int64 {
|
||||||
|
return this.nowTime.Unix()
|
||||||
|
}
|
||||||
|
@ -5,6 +5,7 @@ import "q5"
|
|||||||
var App *App_
|
var App *App_
|
||||||
var _Timer *q5.Timer
|
var _Timer *q5.Timer
|
||||||
var _SysLog *SysLog_
|
var _SysLog *SysLog_
|
||||||
|
var _TgLog *TGLog_
|
||||||
|
|
||||||
func Timer() *q5.Timer {
|
func Timer() *q5.Timer {
|
||||||
return _Timer
|
return _Timer
|
||||||
@ -13,3 +14,7 @@ func Timer() *q5.Timer {
|
|||||||
func SysLog() *SysLog_ {
|
func SysLog() *SysLog_ {
|
||||||
return _SysLog
|
return _SysLog
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TgLog() *TGLog_ {
|
||||||
|
return _TgLog
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user