Advertisement

04.28.2008 at 08:27PM PDT, ID: 23360945
[x]
Attachment Details

Are assignments atomic operations?

Asked by CyrexCore2k in C Programming Language, C++ Programming Language

If I have two threads that have access to an unsigned short i and one thread is running

while(1)
{
   i = 1;
   i = 256;
}

and another thread is running

while(1)
{
   if(i == 257)
      printf("Aha!");
}

Will "Aha!" ever be printed on the screen?

Start Free Trial
 
Loading Advertisement...
 
[+][-]04.28.2008 at 08:40PM PDT, ID: 21459506

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.28.2008 at 08:41PM PDT, ID: 21459512

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.28.2008 at 08:42PM PDT, ID: 21459516

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.28.2008 at 08:43PM PDT, ID: 21459519

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.28.2008 at 08:51PM PDT, ID: 21459569

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.28.2008 at 08:59PM PDT, ID: 21459604

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.28.2008 at 09:02PM PDT, ID: 21459623

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.28.2008 at 09:07PM PDT, ID: 21459643

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: C Programming Language, C++ Programming Language
Sign Up Now!
Solution Provided By: jaime_olivares
Participating Experts: 3
Solution Grade: A
 
 
[+][-]04.28.2008 at 09:14PM PDT, ID: 21459671

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_EXPERT_20070906