Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

Why stop and suspend method are deprecated?

deprecated method suspend
0
Posted

Why stop and suspend method are deprecated?

0

Stop() terminates the thread abruptly while suspend() method blocks a thread until another thread calls resume () on it. Stop () method will leave an object in inconsistent state because it immediately gives up locks on all other object that it has locked. For example, during transfer of money from one account to other account if the transfer thread is stopped, the bank account object is damaged. When a thread wants to stop another thread, it doesn’t know when it is safe to stop that thread. So it has been deprecated. Suspend () method frequently leads to deadlocks .It can be invoked on a thread externally at any point of time without the threads consent which is not desired. For this reason it has been deprecated.

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.