Handler, logoff, message

Source: Internet
Author: User

1. when a handler creates an instance, it is associated with a logoff object, which is a member of its corresponding thread variable copy-threadlocal variable. When it sendmessage, the message. set the handler object of the taget and add it to the messagequeue Of The logoff, waiting for the message loop.

2. logoff manages a messagequeue. logoff is called in the run () method of the thread. loop (), cyclically fetch the message from messagequeue, so that the thread becomes a logoff thread. Message is called every time the message is retrieved. taget. dispathmessage (MSG) indirectly calls handler. handlmessage () method.

3. the message uses the set bundle object, and then the handler instance sendmessage () in a thread adds the message to the messagequeue in the corresponding thread of the logoff for event loop, in this way, Inter-thread data communication is realized.

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.