local variables of static member functions

后端 未结 4 1421
终归单人心
终归单人心 2021-02-19 06:25

Today we came accross a problem concerning static member functions in an multithreaded environment. The question we asked ourselves and couldn\'t find a satisfying answer is: ar

4条回答
  •  刺人心
    刺人心 (楼主)
    2021-02-19 06:48

    No. The stack frames are independent for each thread's invocation of the function, and each gets its own locals. (You do need to be careful if you're accessing actual shared data e.g. static members in the class.)

提交回复
热议问题