Breaking News: Grepper is joining You.com. Read the official announcement!
Check it out

Why we should not stop a thread by calling its stop() method?

Pragya Keshap answered on February 4, 2023 Popularity 3/10 Helpfulness 1/10

Contents


More Related Answers

  • exit all threads from within a thread python
  • What all methods are used to prevent thread execution ?
  • python stop daemon thread
  • java how to stop a thread
  • python kill all threads
  • python wait for thread to finish
  • python thread stop
  • what happens when you call Thread.sleep()
  • python kill thread
  • What all methods are used to prevent thread execution ?
  • python how to restart thread
  • how to stop thread python
  • prevent creating instance of singleton from thread
  • kill thread
  • shutdown thread python
  • Python kill thread after script ends
  • Can we restart a thread already started in java?
  • Always terminate the thread which it is interrupted
  • different ways you can interrupt a thread execution.
  • how do i close a sys even if there is a thread running'
  • how to stop runnable thread in android
  • python kill all threads

  • Why we should not stop a thread by calling its stop() method?

    0

    The stop() method in Thread class is a deprecated method. Its use is

    not recommended.

    When we call stop() method, the thread unlocks all monitors that it

    has acquired. If any locked object was in an inconsistent state, this

    state gets visible to all other threads.

    It can cause unexpected behavior when other threads work on this

    inconsistent object.

    So calling stop() method to stop a thread is not advisable.

    https://www.tutorialspoint.com/how-can-we-stop-a-thread-in-java

    Popularity 3/10 Helpfulness 1/10 Language java
    Source: Grepper
    Tags: java
    Link to this answer
    Share Copy Link
    Contributed on Feb 04 2023
    Pragya Keshap
    0 Answers  Avg Quality 2/10


    X

    Continue with Google

    By continuing, I agree that I have read and agree to Greppers's Terms of Service and Privacy Policy.
    X
    Grepper Account Login Required

    Oops, You will need to install Grepper and log-in to perform this action.