Is there a good method in C# for throwing an exception on a given thread

前端 未结 8 1493
刺人心
刺人心 2020-12-16 01:22

The code that I want to write is like this:

void MethodOnThreadA()
{
    for (;;)
    {
        // Do stuff
        if (ErrorConditionMet)
            ThrowO         


        
8条回答
  •  Happy的楠姐
    2020-12-16 02:15

    While researching another issue, I came across this article which reminded me of your question:

    Plumbing the Depths of the ThreadAbortException using Rotor

    It shows the gyrations that .NET goes through to implement Thread.Abort() -- presumably any other cross-thread exception would have to be similar. (Yeech!)

提交回复
热议问题