提交origin2.0版本

This commit is contained in:
duanhf2012
2020-03-28 09:57:16 +08:00
parent 0d98f77d07
commit 84fb8ab36d
111 changed files with 3657 additions and 8382 deletions

53
service/servicemgr.go Normal file
View File

@@ -0,0 +1,53 @@
package service
//本地所有的service
var mapServiceName map[string]IService
func init(){
mapServiceName = map[string]IService{}
}
func Init(chanCloseSig chan bool) {
closeSig=chanCloseSig
for _,s := range mapServiceName {
s.OnInit()
}
}
func Setup(s IService) bool {
_,ok := mapServiceName[s.GetName()]
if ok == true {
return false
}
//s.Init(s)
mapServiceName[s.GetName()] = s
return true
}
func GetService(servicename string) IService {
s,ok := mapServiceName[servicename]
if ok == false {
return nil
}
return s
}
func Start(){
for _,s := range mapServiceName {
s.Start()
}
}
func WaitStop(){
for _,s := range mapServiceName {
s.Wait()
}
}