Home > Net >  C # CheckForIllegalCrossThreadCalls influence and confirmation of true and false of the thread??????
C # CheckForIllegalCrossThreadCalls influence and confirmation of true and false of the thread??????

Time:09-16

In the company maintain a decade ago WinForm old program, and this program through the hand of the people change,
Leadership let me modify part of the program, I found a problem in the process of modification, the form of the old program with a lot of the Timer, there is also a part of the thread,
But program USES CheckForIllegalCrossThreadCalls=false statements, the inquiry found that the statement is used to cross thread calls don't need to be adopted to entrust, can be called directly,
In the update offline map primitive state, use a thread to update, but found that primitive update very slow, very few primitives, but update speed like a snail in climbing, so repeatedly find update part why so slowly, but didn't find (based on the can directly call the UI controls), then there is no way, try the mentality of the entrusted way update primitives, the result is very good, at least a lot faster than it is,

Say so many, is actually want to know about the:
CheckForIllegalCrossThreadCalls=false statements under the condition of existence, as the direct manipulation of the UI control thread and the relationship between the main thread, to entrust and do not use in use, the difference between a

My personal understanding, independent create threads, after using the above statement, a direct call to change the part of the UI controls, can lead to a separate thread processing and the processing of the main thread down together, or wait for the mainline Cheng Youkong processing, so there will be a separate thread is not independent, don't know if I understand right?? Also please be aware that follows!!!!



CodePudding user response:

I see online explanation is CheckForIllegalCrossThreadCalls=true; When the.net UI controls on the program used for security checks, avoid deadlock, across threads right state of bug
While CheckForIllegalCrossThreadCalls=false; .net not using UI controls for the security check, the program on programmer to avoid above all bugs, in fact or multiple threads to manipulate interface controls

CodePudding user response:

reference 1st floor OrdinaryCoder response:
I see online explanation is CheckForIllegalCrossThreadCalls=true; When the.net UI controls on the program used for security checks, avoid deadlock, across threads right state of bug
While CheckForIllegalCrossThreadCalls=false; .net not using UI controls for the security check, the program on programmer to avoid above all bugs, or multiple threads of interface control operation

Should actually be a multithreaded, but call UI controls, feeling is under a processing threads,

CodePudding user response:

Set up CheckForIllegalCrossThreadCalls=false this is equivalent to live among the rubbish, application data and business logic are subject to random walk, because the thread conflict completely uncertain, completely out of control, this design only for beginners of eyes is "convenient" little, or no contact with multithreaded programming 20 years ago, people just beginners thread to use,
  •  Tags:  
  • C #
  • Related