Skip to content

Instantly share code, notes, and snippets.

@gamlerhart
Created June 30, 2010 19:58
Show Gist options
  • Save gamlerhart/459133 to your computer and use it in GitHub Desktop.
Save gamlerhart/459133 to your computer and use it in GitHub Desktop.
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
}
AppDomain.CurrentDomain.UnhandledException +=
sender, eventArgs) =>
Console.Out.WriteLine("Oh boy, crash {0}",eventArgs.ExceptionObject);
Action workItem = ()=> { };// work item from the application;
ThreadPool.QueueUserWorkItem(ignored => workItem());
// more stuff for synchronization
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