chinedu iroanyah wrote:sorry for that, here is a better formatted code:
Henry Wong wrote:
1. Do more iterations. 10 iterations is way too small. It is possible for a thread to start, and do the 10 iterations before the other thread even starts. Try a bigger number -- like 10 million iterations.
2. Have each thread do separate counts. Instead of having both threads work until the counter hits 10 million, have each thread do exactly 5 million iterations.... then after both threads have completed, check to see if the total is correct. This way, you can tell if the threads accidentally redid iterations.
chinedu iroanyah wrote:thank you so much for the help so far, but I have tried increasing the loop to 10 million iterations but it still does not show the "Unsafe operation detected" output. please could you to see if am wrong. here is the code:
chinedu iroanyah wrote:once again thank you so much for all the help, this time i used the second option that you gave me but still it does not print the "Unsafe operation detected". sorry for the formatting am not too familiar with posting
Jeff Verdegan wrote:Please BeForthrightWhenCrossPostingToOtherSites(⇐click) so that people don't waste their time repeating each others' answers.