C++Talk.NET Forum Index C++Talk.NET
C++ language newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

volatile variables

 
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C Language
View previous topic :: View next topic  
Author Message
junky_fellow@yahoo.co.in
Guest





PostPosted: Mon May 14, 2007 9:12 am    Post subject: volatile variables Reply with quote



Guys,

If I have a global variable, that is shared across multiple
threads on an SMP environment, then do I need to declare it as
volatile, so that a particular processor does not store and access its
vlaue fron the processor registers ?

thnaks in advance for any help ...
Back to top
Hari
Guest





PostPosted: Mon May 14, 2007 9:12 am    Post subject: Re: volatile variables Reply with quote



junky_fellow (AT) yahoo (DOT) co.in je napisao:
Quote:
Guys,

If I have a global variable, that is shared across multiple
threads on an SMP environment, then do I need to declare it as
volatile, so that a particular processor does not store and access its
vlaue fron the processor registers ?

thnaks in advance for any help ...

Having volatile type qualifier is mainly to do with the problems that
are encountered in real-time or embedded systems.

Quote:
so that a particular processor does not store and access its
vlaue fron the processor registers

yes, volatile will use direct access, and probably switch of
optimization

Quote:
If I have a global variable, that is shared across multiple
threads on an SMP environment, then do I need to declare it as
volatile

I think that you must use some thread locking mechanism, not volatile,
to use global variable with multiple threads. Search net for thread
locking
for your platform.

Best,
Zaharije Pasalic
Back to top
Display posts from previous:   
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C Language All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.