Home > Back-end >  Execute the same code debug mode and normal mode, the result is different
Execute the same code debug mode and normal mode, the result is different

Time:12-19

Deep understanding of Java virtual machine (the third edition (zhi-ming zhou teacher) on page 605

Compile tools is the idea of
Question: why in the debug mode, the program can normal end, output value of the race, but has been performed in normal mode, while the equivalent of an infinite loop, Thread. The activeCount () has always been a value greater than 1,

CodePudding user response:

refer to the original poster colour my life reply:
deep understanding of Java virtual machine (the third edition (zhi-ming zhou teacher) on page 605
Compile tools is the idea of
Question: why in the debug mode, the program can normal end, output value of the race, but has been performed in normal mode, while the equivalent of an infinite loop, Thread. The activeCount () has always been a value greater than 1,


I saw you use threads in the debug mode, because every breakpoint suspended, so quite so according to certain order, however, when the normal operation of the thread program execution order is out-of-order, the resulting data and executed according to certain order data, the result will be different

CodePudding user response:

Breakpoints in your main thread sleep, finished all of you for loop code execution, so you can out of the while loop later

CodePudding user response:

1. I don't have a break point in the program, just use the debug launch, this is implied: program according to the code of order execution, don't know if I understand it right?
  • Related