1
This commit is contained in:
parent
ef23a486d3
commit
7442ad5d81
11
listhead.go
11
listhead.go
@ -6,10 +6,10 @@ type ListHead struct {
|
|||||||
data interface{}
|
data interface{}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *ListHead) Init() {
|
func (this *ListHead) Init(data interface{}) {
|
||||||
this.next = this
|
this.next = this
|
||||||
this.prev = this
|
this.prev = this
|
||||||
this.data = nil
|
this.data = data
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *ListHead) Del() {
|
func (this *ListHead) Del() {
|
||||||
@ -36,12 +36,12 @@ func (this *ListHead) Replace(pnew *ListHead) {
|
|||||||
pnew.next.prev = pnew
|
pnew.next.prev = pnew
|
||||||
pnew.prev = this.prev
|
pnew.prev = this.prev
|
||||||
pnew.prev.next = pnew
|
pnew.prev.next = pnew
|
||||||
pnew.data = this.data
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *ListHead) ReplaceInit(pnew *ListHead) {
|
func (this *ListHead) ReplaceInit(pnew *ListHead) {
|
||||||
this.Replace(pnew)
|
this.Replace(pnew)
|
||||||
this.Init()
|
this.next = this
|
||||||
|
this.prev = this
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *ListHead) Empty() bool {
|
func (this *ListHead) Empty() bool {
|
||||||
@ -50,5 +50,6 @@ func (this *ListHead) Empty() bool {
|
|||||||
|
|
||||||
func (this *ListHead) DelInit() {
|
func (this *ListHead) DelInit() {
|
||||||
this.Del()
|
this.Del()
|
||||||
this.Init()
|
this.next = this
|
||||||
|
this.prev = this
|
||||||
}
|
}
|
||||||
|
4
timer.go
4
timer.go
@ -38,7 +38,7 @@ func (this *Timer) Init(
|
|||||||
cacheTimerNum int32) {
|
cacheTimerNum int32) {
|
||||||
initListHeadFunc := func (data interface{}) {
|
initListHeadFunc := func (data interface{}) {
|
||||||
head := data.(*ListHead)
|
head := data.(*ListHead)
|
||||||
head.Init()
|
head.Init(nil)
|
||||||
}
|
}
|
||||||
initListHeadFunc(&this.freeTimerList)
|
initListHeadFunc(&this.freeTimerList)
|
||||||
TraverseArray(&this.tv1, initListHeadFunc)
|
TraverseArray(&this.tv1, initListHeadFunc)
|
||||||
@ -122,7 +122,7 @@ func (this *Timer) Update() {
|
|||||||
func (this *Timer) NewTimerAttacher() *TimerAttacher {
|
func (this *Timer) NewTimerAttacher() *TimerAttacher {
|
||||||
attacher := new(TimerAttacher)
|
attacher := new(TimerAttacher)
|
||||||
attacher.timer = this
|
attacher.timer = this
|
||||||
attacher.timers.Init()
|
attacher.timers.Init(nil)
|
||||||
return attacher
|
return attacher
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,8 +49,8 @@ func (this *TimerList) reset() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (this *TimerList) init() {
|
func (this *TimerList) init() {
|
||||||
this.entry.Init()
|
this.entry.Init(this)
|
||||||
this.attachEntry.Init()
|
this.attachEntry.Init(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *TimerList) SetTimerAfterFunc(timerAfterFunc func(*XParams)) {
|
func (this *TimerList) SetTimerAfterFunc(timerAfterFunc func(*XParams)) {
|
||||||
@ -58,6 +58,5 @@ func (this *TimerList) SetTimerAfterFunc(timerAfterFunc func(*XParams)) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (this *TimerList) Attach(timerAttacher *TimerAttacher) {
|
func (this *TimerList) Attach(timerAttacher *TimerAttacher) {
|
||||||
this.attachEntry.data = this
|
|
||||||
timerAttacher.timers.AddTail(&this.attachEntry)
|
timerAttacher.timers.AddTail(&this.attachEntry)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user