Sunday, February 9, 2014
android when it will choose to use the radio to communicate between threads
android when it will choose to use the radio to communicate between threads
Reply:
Do not use radio communication thread it can be used in the process of communication or broadcast aidl
Reply:
However, these two days to see the projects are doing; reason then he analyzed the next, you can also think about the establishment;
1 Under normal circumstances, we choose the mechanism to communicate the message handler unidirectional threads; (worker thread sends a message to the main thread)
Because the main thread a ready handler, while the worker thread is no ready handler, this is the case, the main thread handler to work and let the worker thread to thread the results of the work to the main thread;
Instead, the worker thread is not ready handler (in fact there is no message queue handler is not bound to a worker thread), then, if opened, the code point of view is very troublesome (corresponding to a broadcast mechanism is);
2 broadcast mechanism itself is a two-way (sending broadcast worker thread to the main thread, the main thread sends a broadcast to the worker thread);
/ / In addition, as an activity carried out by the interface fragment processing; mechanism in most of our cases are broadcast using the adapter to achieve the fragment data update; do so mainly on account of the work of the task thread has finished loading, The specific activity of the corresponding refresh may not start;
In addition, based on the principles of the interface isolation, if communication with the handler, then can not meet this principle;
Reply:
If you use a relatively long period it better broadcast
Reply:
Should not very close relationship with the cycle. The main reason is two lines into a two-way communication.
Handler similar P2P communications.
Broadcast is similar to a server-side, to handle requests to distribute different threads, from the perspective of the controller is a little better with the broadcast.
Handler general use, multi-threaded processing services for the child, inform the main thread to complete this kind of situation.
While a similar need for frequent interaction between the landlord said multiple threads, the broadcast is a good choice and a clear structure, just do not know the broadcast performance compared to what will happen with the handler.
Reply:
Thank you for sharing your ideas!
Reply:
He put the code up to look at?
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment