answersLogoWhite

0

How do you suspend thread?

User Avatar

Anonymous

13y ago
Updated: 8/20/2019

Once a thread begins executing its run() method, it continues execution until the run() method completes. If you're familiar with other thread models, you may know of a concept called thread suspension, where a thread is told to pause its execution. Later, the thread is resumed, which is to say that it is told to continue its execution. The Thread class contains suspend() and resume() methods, but they suffer from the same race condition problem as the stop() method, and they, too, are deprecated.

It is possible for a thread to suspend its own execution for a specific period of time by calling the sleep() method. When a thread executes the sleep() method, it pauses for a given number of milliseconds, during which it is said to be asleep. When the pause time has elapsed, the thread wakes up and continues execution with the statements immediately following the sleep() method.

User Avatar

Wiki User

13y ago

What else can I help you with?

Related Questions

How do you grow a seed crystal?

make a saturated solution of sugar and suspend a thread for three days or more


What is the difference between suspending stopping a thread?

Suspending a thread temporarily halts its execution, allowing it to be resumed later. Stopping a thread terminates its execution completely, preventing it from being resumed. It is generally recommended to avoid using the stop method as it can lead to unpredictable behavior and potential resource leaks.


Old wives tales about guessing boy or girl?

suspend a needle on a thread over the pregnant mother's open palm and depending which way the needle swings determines the sex of the baby.


How do you create an application that will open a file every 10 seconds?

In Windows, use the ::Sleep () function to suspend the current thread for a specified time. Or use the ::SleepEx() function if you also want an alertable state.


What is the verb for suspense?

The verb for suspense is "to suspend."


How do you use the word suspend in a sentence?

Examples: I hoped the principal would not suspend me. Suspend the crate in the air, with a rope.


How do use the word suspend in a sentence?

Examples: I hoped the principal would not suspend me. Suspend the crate in the air, with a rope.


What is the past tense of suspend?

The past tense of suspend is suspended.


What is the past participle of suspend?

Suspended is the past participle of suspend.


How do you test whether a given rod is a magnet or not?

To start with we can suspend it freely by tying with a torsion less thread. If the axis of the rod always stands along north-south direction then we can conclude that the rod is a magnet. Moreover as we bring pins or nails then they will be attracted by the rod. This confirms that the rod is magnetic.


Which syllable is stressed in the word suspend?

Suspend is stressed on the second syllable.


Is a WikiAnswers Supervisor allowed to suspend someone?

Suspend as in block, yes.