Access static constant variable from multiple threads in C

Posted by user325519 on Stack Overflow See other posts from Stack Overflow or by user325519
Published on 2010-05-17T09:33:49Z Indexed on 2010/05/17 9:40 UTC
Read the original article Hit count: 171

Filed under:
|
|

I have some experience with multithread programming under Linux (C/C++ & POSIX threads), however most obvious cases are sometimes very complicated.

I have several static constant variables (global and function local) in my code, can I access them simultaneously from multiple threads without using mutexes? Because I don't modify them it should be ok, but it's always better to ask.

I have to do heavy speed optimization, so even as fast operations as mutex lock/unlock are quite expensive for me, especially because my application is going to access these variables form long loops.

© Stack Overflow or respective owner

Related posts about pthread

Related posts about c