Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Result unclear

 
Val Dra
Ranch Hand
Posts: 439
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi can someone explain why result is 5 and not 10 ? We do change the value of x so how come it's not changed ? Is this because at this exact time the thread might not have been started to run yet ? I don't think that's the answer though but i haven't recieved any answer on this yet. Thank you.
 
sreek, Thiru
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes , it seems that only because the thread might not have been started yet.. the result is so....
if we introduce sleep of even 1 ms u will get 10.(i ran it so)
i ran it with sleep(0)... it gave me 5.. I wonder what would a thread do for sleep(0)???
sreek
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!