Example #1
0
func (this *Thread) sendMsg(msgObject *MsgObject) {
	exception.Try(
		func() {
			this.msgChannel <- msgObject
		},
		func(exception interface{}) {
			fmt.Println(exception)
		})
}
Example #2
0
func (this *Thread) notifyDaemonRoutineExit() {
	if this.isDaemonMode {
		exception.Try(
			func() {
				this.shouldDaemonChannelQuit <- true
			},
			func(exception interface{}) {
				fmt.Println(exception)
			})
	}
}
func (this *ThreadPool) Stop() {
	for i := 0; i < this.threadArray.Len(); i++ {
		thread := this.threadArray.GetObjectAtIndex(i).(thread.IThread)
		thread.Stop()
	}
	this.threadArray.RemoveAllObjects()

	if this.isDaemonMode {
		exception.Try(
			func() {
				this.shouldDaemonChannelQuit <- true
			},
			func(exception interface{}) {
				fmt.Println(exception)
			})
	}
}