Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Programming Threads > Need for mutexe...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 5 Topic 4046 of 4146
Post > Topic >>

Need for mutexes when reading global variables

by "lancer6238@[EMAIL PROTECTED] " <lancer6238@[EMAIL PROTECTED] > Sep 22, 2008 at 07:29 PM

Hi all,

Is there a need to put a mutex around the reading of a global variable
that is initialized before any threads are created and remains
unchanged for the duration of the program, even though there is no
writes to it?

I thought that as long as I don't alter the value of the global
variable, it should be fine. I'm asking because the program I'm
writing involves having threads read and use values from a global
structure for the entire computation function they execute. If I put a
mutex around that, then it's as good as not having multiple threads at
all.

Thank you.

Regards,
Rayne
 




 5 Posts in Topic:
Need for mutexes when reading global variables
"lancer6238@[EMAIL P  2008-09-22 19:29:28 
Re: Need for mutexes when reading global variables
"Chris M. Thomasson&  2008-09-22 20:11:55 
Re: Need for mutexes when reading global variables
Philip Guenther <guent  2008-09-22 20:07:54 
Re: Need for mutexes when reading global variables
Neel <a.k.vora@[EMAIL   2008-09-25 22:58:21 
Re: Need for mutexes when reading global variables
"Chris M. Thomasson&  2008-09-26 15:49:20 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat Nov 22 7:44:14 CST 2008.