Created
June 30, 2010 19:58
-
-
Save gamlerhart/459133 to your computer and use it in GitHub Desktop.
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
Action workItem = () => | |
{ | |
throw new ExpectedExeption(); | |
}; | |
var syncHandle = workItem.BeginInvoke(null, null); | |
// later | |
try | |
{ | |
workItem.EndInvoke(syncHandle); | |
}catch (ExpectedExeption e) | |
{ | |
// on the end invoke the exception is thrown! | |
// If you don't get the result, the exception is swallowed | |
} |
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
AppDomain.CurrentDomain.UnhandledException += | |
sender, eventArgs) => | |
Console.Out.WriteLine("Oh boy, crash {0}",eventArgs.ExceptionObject); |
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
Action workItem = ()=> { };// work item from the application; | |
ThreadPool.QueueUserWorkItem(ignored => workItem()); | |
// more stuff for synchronization |
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
Action workItem = () => { };// work item from the application; | |
var syncHandle = workItem.BeginInvoke(null, null); | |
// more stuff for synchronization |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment