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

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

The code that I want to write is like this:

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


        
8条回答
  •  囚心锁ツ
    2020-12-16 02:11

    I don't think that's a good idea.. Take another crack at this problem - Try using some other mechanism like shared data to signal between threads.

提交回复
热议问题