1
This commit is contained in:
parent
d10752d318
commit
9c2949041a
16
app.go
16
app.go
@ -43,6 +43,7 @@ type App interface {
|
|||||||
|
|
||||||
type UserApp interface {
|
type UserApp interface {
|
||||||
GetPkgName() string
|
GetPkgName() string
|
||||||
|
HasTask() bool
|
||||||
Init()
|
Init()
|
||||||
Update()
|
Update()
|
||||||
UnInit()
|
UnInit()
|
||||||
@ -262,10 +263,12 @@ func (this *app) goLoopTimer() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (this *app) schedule() {
|
func (this *app) schedule() {
|
||||||
|
if !this.hasTask() {
|
||||||
this.chGoLoopWait <- GetTimer().GetIdleTime()
|
this.chGoLoopWait <- GetTimer().GetIdleTime()
|
||||||
this.loopCond.L.Lock()
|
this.loopCond.L.Lock()
|
||||||
this.loopCond.Wait()
|
this.loopCond.Wait()
|
||||||
this.loopCond.L.Unlock()
|
this.loopCond.L.Unlock()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *app) NotifyLoopCond() {
|
func (this *app) NotifyLoopCond() {
|
||||||
@ -425,6 +428,19 @@ func (this *app) clearEmptyPendingAsyncTask(key string) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (this *app) hasTask() bool {
|
||||||
|
hasTask := false
|
||||||
|
{
|
||||||
|
this.imMsgMutex.Lock()
|
||||||
|
hasTask = this.imTopNode != nil || this.imWorkNode != nil
|
||||||
|
this.imMsgMutex.Unlock()
|
||||||
|
}
|
||||||
|
if !hasTask {
|
||||||
|
hasTask = this.userApp.HasTask()
|
||||||
|
}
|
||||||
|
return hasTask
|
||||||
|
}
|
||||||
|
|
||||||
func parseArgs() (int, int) {
|
func parseArgs() (int, int) {
|
||||||
args := os.Args[1:]
|
args := os.Args[1:]
|
||||||
if len(args) <= 0 {
|
if len(args) <= 0 {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user