不同线程上的异常? [英] Exceptions on a diffrent thread?

查看:79
本文介绍了不同线程上的异常?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嘿!

我正在像这样使用ThreadPool

公用静态void OpenSplashScreen() { 尝试 fSplash fSplash. LoginSucceeded + =新的EventHandler(fSplash_LoginSucceeded); ThreadPool.QueueUserWorkItem(new WaaCallback(fSplash.Start)); { ;'',ExceptionType.UnexceptedException,ExceptionSeverity.Error,null,","ex"); 解决方案

我不认为这是线程异常的工作方式.当您生成线程时,它具有自己的唯一调用堆栈.当该线程中出现线程时,它将使该线程的调用堆栈冒泡,直到到达顶部为止.此时,如果未处理,该线程将终止.

该异常不会被编组回产生该异常的主线程.



Hey!

I am using the ThreadPool like this

        public static void OpenSplashScreen() 
        { 
            frmSplashScreen fSplash; 
            try 
            { 
                fSplash = new frmSplashScreen(); 
 
                fSplash.LoginSucceeded += new EventHandler(fSplash_LoginSucceeded); 
                ThreadPool.QueueUserWorkItem(new WaitCallback(fSplash.Start)); 
            } 
            catch (Exception ex) 
            { 
                throw new ExceptionHandler("", ExceptionType.UnexceptedException, ExceptionSeverity.Error, null, "", ex); 
            } 
        }

解决方案

I don't think that is how exception in thread work.  When you spawn a thread it has its own unique call stack.  When a thread occurs in that thread it will bubble up that thread's call stack until it reaches the top.  At that point if un-handled that thread will terminate.

That exception won't be marshaled back to the main thread which spawned the thread with the exception.



这篇关于不同线程上的异常?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆