Forums Register Login

How to start ,suspend, resume Thread in java?

+Pie Number of slices to send: Send
Hello!

This is merely impossible to bear. I do not know Java Threads at all. What is that?

Here is my primitive Thread:

As you see it is simple. Here is my code that starts thread :

This method creates SplashTooltipThread and executes run method once, then run sets isRunning to false(line 13) to stop executing run method.

However when I again call this method(sleepAndShowTooltip) I do not create SplashTooltipThread but instead I only set its variable isRunning to true. I expect that my SplashTooltipThread will again execute method run once. But it never happens. I print that splashTooltipThread.isRunning is true but splashTooltipThread does not execute its run method again.

What happened to while loop inside run method and why it does not see that I set back isRuning to true.

Thank you!
+Pie Number of slices to send: Send
Oops!

I am sorry, this saturday evening. Do not read that nonsense, I need a rest
Been there. Done that. Went back for more. But this time, I took this tiny ad with me:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 1740 times.
Similar Threads
Removing objects (Threads)
best way to kill ?
Simulating Power Supply Unit.
terminating one main class thru another mani class?
Thread and variable value question?
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 16:54:47.