Skip to content

Commit

Permalink
Merge branch '1.8泛型'
Browse files Browse the repository at this point in the history
  • Loading branch information
bobohume committed Apr 1, 2023
2 parents 1d892f3 + 45be401 commit 91e1499
Show file tree
Hide file tree
Showing 30 changed files with 586 additions and 1,016 deletions.
12 changes: 6 additions & 6 deletions actor/Actor.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ type (
id int64
state int32
trace traceInfo //trace func
mailBox *mpsc.Queue
mailBox *mpsc.Queue[*CallIO]
mailIn [8]int64
mailChan chan bool
timerId *int64
Expand Down Expand Up @@ -148,8 +148,8 @@ func (a *Actor) Acotr() *Actor {
}

func (a *Actor) Init() {
a.mailChan = make(chan bool, 1)
a.mailBox = mpsc.New()
a.mailChan = make(chan bool)
a.mailBox = mpsc.New[*CallIO]()
a.acotrChan = make(chan int, 1)
a.timerMap = make(map[uintptr]func())
//trance
Expand Down Expand Up @@ -214,7 +214,7 @@ func (a *Actor) Send(head rpc.RpcHead, packet rpc.Packet) {
io.RpcHead = head
io.RpcPacket = packet.RpcPacket
io.Buff = packet.Buff
a.mailBox.Push(io)
a.mailBox.Push(&io)
if atomic.LoadInt64(&a.mailIn[0]) == 0 && atomic.CompareAndSwapInt64(&a.mailIn[0], 0, 1) {
a.mailChan <- true
}
Expand All @@ -224,7 +224,7 @@ func (a *Actor) Trace(funcName string) {
a.trace.funcName = funcName
}

func (a *Actor) call(io CallIO) {
func (a *Actor) call(io *CallIO) {
rpcPacket := io.RpcPacket
head := io.RpcHead
funcName := rpcPacket.FuncName
Expand Down Expand Up @@ -270,7 +270,7 @@ func (a *Actor) UpdateTimer(ctx context.Context, ptr uintptr) {
func (a *Actor) consume() {
atomic.StoreInt64(&a.mailIn[0], 0)
for data := a.mailBox.Pop(); data != nil; data = a.mailBox.Pop() {
a.call(data.(CallIO))
a.call(data)
}
}

Expand Down
2 changes: 1 addition & 1 deletion base/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ func ToString(value interface{}) string {
}

//---------遍历子目录------------//
func WalkDir(dirpath string, filesVec *vector.Vector) {
func WalkDir(dirpath string, filesVec *vector.Vector[os.FileInfo]) {
files, err := ioutil.ReadDir(dirpath) //读取目录下文件
if err != nil {
return
Expand Down
247 changes: 0 additions & 247 deletions base/containers/comparator.go

This file was deleted.

Loading

0 comments on commit 91e1499

Please sign in to comment.