You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@brpc.apache.org by GitBox <gi...@apache.org> on 2022/12/08 04:12:24 UTC

[GitHub] [incubator-brpc] jiangdongzi commented on issue #2042: 普通线程中调用bthread_start_background100次,在函数中打印对应的stack 100次执行的都是一个值,对应的cur_tid都是0,我打印前是取出来对应的值赋值局部变量打印的

jiangdongzi commented on issue #2042:
URL: https://github.com/apache/incubator-brpc/issues/2042#issuecomment-1341969283

   > 贴下代码吧
   
   ![image](https://user-images.githubusercontent.com/17529657/206354349-c8929561-2d0e-40e5-a8e2-79f4f43ed649.png)
   这个简单的demo执行是正常的, 我们的服务器上打印不正常, 打印的所有cur_stack都是一个值, 所以的cur_tid都是0, 而, 这个demo不是 (基本完全一样的代码),  唯一的区别是, demo的 bthread_start_backgroud是在主线程执行, 而我们服务器上是在 pthread_create 出来的线程中执行的.  但是 bthread_start_backgroud 返回的tid是正确的值, 就是在真正的逻辑中打印的tid都是0, stack都是同一值, 但是看日志又是并发的, 不是串行的,  而打印的stack是一个值, 我理解应该是串行的, 这就矛盾了, 麻烦帮忙看看, 有什么可能导致了服务和demo的不同


-- 
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: dev-unsubscribe@brpc.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org