Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

zinx这种情况是否需要加锁 #171

Closed
jonny91 opened this issue Jan 22, 2023 · 1 comment
Closed

zinx这种情况是否需要加锁 #171

jonny91 opened this issue Jan 22, 2023 · 1 comment

Comments

@jonny91
Copy link

jonny91 commented Jan 22, 2023

你好 请问两个玩家A和B
假设A发送消息1 A.coin + 5 ,B.coin - 5
根据work queue逻辑 A.coin+5会在一个work中执行 那B.coin-5这个操作也在这个work.里做 还是发个消息 在B session对应的work里执行?(这样的话就要对coin加rwmutex了吧?)

@YanHeDoki
Copy link
Collaborator

这个只需要一条消息处理吧,即A发送两个操作的消息给服务器处理,不过coin也应该上锁,如果他是map或者是切片什么的,就算是一个消息也可能被多个消息请求操作

@jonny91 jonny91 closed this as completed Apr 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants