相关: 如何从ThreadPool.QueueUserWorkItem中排出例外情况?
我正在追捕由),并通过共享的试样向主线传播。
The background reads do this:
try
{
... stuff happens here...
}
catch (Exception ex1)
{
lock(eLock)
{
// record only the first exception
if (_pendingException == null)
_pendingException = ex1;
}
}
有许多潜在的作者——多面背景之子——可以选择接受,因此,我有24小时保护。
在主线上,我是否在阅读<代码>之前24小时? 或者,我只能这样做:
if (_pendingException != null)
ThrowOrHandle();
EDIT:
ps: I would prefer to NOT take the lock on the reader thread because it is on the hot path, and I d be taking and releasing the lock very, very often.