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 > Would race cond...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 14 Topic 4078 of 4146
Post > Topic >>

Would race condition like this be harmful?

by "news.cn99.com" <ia_iaic@[EMAIL PROTECTED] > Oct 11, 2008 at 02:09 AM

Hi all

I have a piece of code like this:

volatile long i = 4000000;

//thread 1:
while(i != 0)
{
}


//thread 2:
while(i != 0)
{
    InterlockedDecrement(&i);
}

the Intel Thread Checker re****ts there are race conditions here, but I
think 
they are innocuous.
Though I can eliminate these race conditions by using 
InterlockedCompareExchange(&i,0,0) != 0,
I want to know if it is necessary to eliminate these race conditions?
Thanks!
 




 14 Posts in Topic:
Would race condition like this be harmful?
"news.cn99.com"  2008-10-11 02:09:39 
Re: Would race condition like this be harmful?
Szabolcs Ferenczi <sza  2008-10-10 11:33:28 
Re: Would race condition like this be harmful?
"Chris M. Thomasson&  2008-10-11 01:10:36 
Re: Would race condition like this be harmful?
David Schwartz <davids  2008-10-11 02:24:38 
Re: Would race condition like this be harmful?
"Chris M. Thomasson&  2008-10-12 15:12:25 
Re: Would race condition like this be harmful?
"Chris M. Thomasson&  2008-10-12 15:13:11 
Re: Would race condition like this be harmful?
"Jerry Qi" <  2008-10-11 22:41:11 
Re: Would race condition like this be harmful?
Szabolcs Ferenczi <sza  2008-10-11 08:38:00 
Re: Would race condition like this be harmful?
David Schwartz <davids  2008-10-12 21:07:42 
Re: Would race condition like this be harmful?
"Chris M. Thomasson&  2008-10-13 09:27:17 
Re: Would race condition like this be harmful?
David Schwartz <davids  2008-10-13 09:32:58 
Re: Would race condition like this be harmful?
"Chris M. Thomasson&  2008-10-10 12:10:40 
Re: Would race condition like this be harmful?
"Jerry Qi" <  2008-10-11 22:41:30 
Re: Would race condition like this be harmful?
David Schwartz <davids  2008-10-10 19:54:23 

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 9:23:43 CST 2008.