Created
June 5, 2014 07:29
-
-
Save andrijac/f3379f3cd126e87ebcd8 to your computer and use it in GitHub Desktop.
C# Threading
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// http://stackoverflow.com/a/363409/84852 | |
System.Threading.ThreadPool.QueueUserWorkItem(delegate { | |
DoSomethingThatDoesntInvolveAControl(); | |
}, null); | |
// http://stackoverflow.com/a/661662/84852 | |
///...blah blah updating files | |
string newText = "abc"; // running on worker thread | |
this.Invoke((MethodInvoker)delegate { | |
someLabel.Text = newText; // runs on UI thread | |
}); | |
///...blah blah more updating files | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment