guoliushui commented on PR #3276:
URL: https://github.com/apache/brpc/pull/3276#issuecomment-4293703377

   > butex_wait 有 acquire 语义。是不是只有没有进入循环的情况下才有问题?
   > 
   > 
https://github.com/apache/brpc/blob/35682ff8d8e567a941035b3c09838dd932465f1f/src/bthread/task_group.cpp#L632-L637
   
   是的,当时也有过这方面的考虑,最后未做区分是否touch到了butex_wait原因如下:
   
   1. 即使之 butex_wait 内部有 acquire,从那个 acquire 到 while 退出的**普通读**之间,invalidate 
queue 可能又积累了新条目。只有在 while 退出后、读用户数据前加 fence,才能保证用户数据可见
   2.   区分逻辑增加复杂度,收益可忽略:多了变量和条件判断,只省下偶尔一条 DMB ISHLD(10~几十ns),在阻塞等待函数中意义不大


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to