Exception thrown in worker

Nov 3, 2009 at 7:39 PM


In WorkItem.cs the worker catches an exception thrown by the function. I see there a comment: // Save the exception so we can rethrow it later.

When is the exception re-thrown?

I really need the exceptions re-thrown into the parent code.



Nov 3, 2009 at 9:58 PM

will this do?


        public void Exception()
            var smartThreadPool = new SmartThreadPool();
            var result = smartThreadPool.QueueWorkItem(MethodThatThrows);

            if (result.Exception != null)
                throw (Exception) result.Exception ;

        public void MethodThatThrows()
            throw new Exception("hello");