Inter-thread communication

Source: Internet
Author: User

1. wait/notification mechanism

What is waiting, notice? For example, there is a restaurant, the chef is responsible for cooking, the waiter is responsible for serving, when the dishes are done, the waiter will need to wait, imagine, if no notice, the waiter will be every once in a while to see the food in the end, and at this time there is a lot of work to do, so he will do a lot of useless Then after the notice, the chef after the dish, the speaker or other way to inform the waiter needs to serve, so that the waiter only receive notice when the end of the dish, you can be relieved to busy the front of the matter.

1. What is the wait and notice mechanism implemented?

Implemented by the Wait (), notify (), or Notifyall () method. All three of these methods belong to the object class.

Wait () is the thread that waits, notify ()

Inter-thread communication

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.