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 > Re: volatile an...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 5 of 6 Topic 4064 of 4146
Post > Topic >>

Re: volatile and 2 processor

by Chris Friesen <cbf123@[EMAIL PROTECTED] > Oct 2, 2008 at 09:56 AM

Chris M. Thomasson wrote:

> Sometimes you need volatile for 
> "certain" things in multi-threaded applications; for instance, the
following 
> loop:
> 
> 
> static atomicword g_running = 1;
> 
> while (g_running) {
> }
> 
> 
> might never terminate if `g_running' was not declared as volatile...

Alternately, you could use locks or barriers and the volatile would not 
be necessary.

Chris
 




 6 Posts in Topic:
volatile and 2 processor
PasDeSpam@[EMAIL PROTECTE  2008-10-01 20:07:35 
Re: volatile and 2 processor
Chris Friesen <cbf123@  2008-10-01 12:47:20 
Re: volatile and 2 processor
David Schwartz <davids  2008-10-01 22:40:13 
Re: volatile and 2 processor
"Chris M. Thomasson&  2008-10-02 00:47:55 
Re: volatile and 2 processor
Chris Friesen <cbf123@  2008-10-02 09:56:53 
Re: volatile and 2 processor
"Chris M. Thomasson&  2008-10-02 09:12:06 

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 8:37:13 CST 2008.