This topic has been archived. It cannot be replied.
-
工作学习 / IT杂谈 / Toy code for Java Thread
-jabber(jabber);
2000-11-3
{894}
(#13059@0)
-
jabber, let me try ...
-canada(canada);
2000-11-12
{642}
(#14189@0)
-
Happy to see your explanation...I cooked up this example as I tried to help one of my colleagues to debug his code.
Most of us know that a Thread cannot be started more than one time....But my friend did make such a mistake in his code: try to restart a thread after it have been dead (run() method has been returned).
No mistake is stupid. But a good programmer should be good at learning lessons from other's mistakes...
-jabber(jabber);
2000-11-12
{399}
(#14216@0)
-
I think the threshold is not less than 1000.First let us ignore the time consumed by executing the code except Thread.sleep().
Second let us ignore the time deviation caused by the kick of the machine's time clock, other processes running, system management, etc.
Then the threshold of the sleeping time of the main thread should be 9999 or less, not less than 1000.
-old(HH);
2000-11-12
{325}
(#14246@0)
-
You are right. I missed one "0".
-canada(canada);
2000-11-13
(#14335@0)
-
Thank you! Sometimes I mistype "0", "00" and something else too. That always waste my time for debugging.
-old(HH);
2000-11-15
(#14608@0)