Hi All,
My understanding was that if I invoke run()from a
thread object directly this would be legal but not create a new call stack or a new thread.
So I wrote the following:
And invoked run() as below....
But I got output:
run:
Invocation : 0: current thread = Thread[Thread-0,5,main]
Invocation : 1: current thread = Thread[Thread-1,5,main]
END
BUILD SUCCESSFUL (total time: 0 seconds)
If I take away the for loop delay statement, I can see the third display from the direct run() call in the main thread. If I put the delay in then I only get two lines as above. I expected to see all three displays as below (in maybe a different order) even with the delay.
run:
Invocation : 0: current thread = Thread[main,5,main]
END
Invocation : 1: current thread = Thread[Thread-0,5,main]
Invocation : 2: current thread = Thread[Thread-1,5,main]
BUILD SUCCESSFUL (total time: 0 seconds)
Can anyone explain why this didn't happen?
Thanks.
-Tom