Skip to content

多次上锁 #2

Description

@wen495713

summer/network/message_router/name_router.go中

func (mr *NameRouter) messageWork

for mr.Running { if mr.messageQueue.Empty() { mr.threadEvent.Wait() //可以通过Set()唤醒 continue } //从消息队列取出一个元素 mr.mutex.Lock() if mr.messageQueue.Empty() { continue } msg := mr.messageQueue.Pop() mr.mutex.Unlock() if p := msg.Message; p != nil { mr.executeMessage(msg) } }

这里在continue之前上锁了,但是没有解锁不会重复上锁吗

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions