In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly shows you the "sample analysis of VS modeling and call", which is easy to understand and clear. I hope it can help you solve your doubts. Let the editor lead you to study and study the "sample analysis of VS modeling and call".
VS modeling is related to the main thread message queue, and only messages sent to the main form can be sent to the interface main thread message queue. We can see that the VS modeling method uses the same implementation, except that one parameter value of the VS modeling method is different.
If your background thread needs to manipulate the UI control and needs to wait until the operation is finished before continuing, then you should use Invoke. Otherwise, when the background thread and the main section thread share some state data, VS modeling may cause problems in the execution sequence if it is not called synchronously, but each continues to execute. Although there is no deadlock, there will be unexpected display results or data processing errors.
VS modeling can see that ISynchronizeInvoke has an attribute, InvokeRequired. The VS modeling property is used to determine at programming time whether an object needs to be marshaled using Invoke or BeginInvoke when accessing the UI control. If you don't need it, you can update it directly. This property returns false when the caller object and the UI object belong to the same thread. As we can see in the later code analysis, the implementation of this property by the Control class determines whether the caller and the control belong to the same thread.
Delegate.BeginInvoke
Asynchronous invocation of synchronous methods through a delegate is also one of the asynchronous invocation mechanisms provided by. Net. But the Delegate.BeginInvoke method takes a thread from the ThreadPool to execute the method to get the effect of asynchronous execution. That is, if multiple asynchronous delegates are submitted in this way, the order of these calls cannot be guaranteed. And because the thread in the thread pool is used to complete the task, it is used frequently, which will affect the performance of the system.
Delegate.BeginInvoke also talks about a delegate method marshaling to other threads to execute a method through an asynchronous mechanism. The caller thread can continue its work after the marshaling is completed. VS modeling but the final thread of execution that this method marshals to is a thread selected by the runtime from within the ThreadPool.
A misunderstanding needs to be corrected here, VS modeling is that the asynchronous call BeginInvoke on the Control class does not open up a new thread to complete the delegate task, but allows the thread to which the interface control belongs to complete the delegate task. It seems that the argument that asynchronous operation is opening up a new thread is not necessarily accurate.
The above is all the contents of the article "sample Analysis of VS Modeling invocation". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.