I implemented multithreading through implemnting runnable and overriding run(). I want to suspend the thread inside run().
Please Help me
What should I do in void run(){ } ?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The usual way to do this is to call
waiton some object that another thread can then notify. This would be the pattern for your code:Then some other thread executes this code:
In these code fragments,
LOCKis some object that is accessible to both pieces of code. There’s no need for a separate object if it makes sense to use an available object to do the job.