不同线程上的异常?

编程入门 行业动态 更新时间:2024-10-20 09:26:09
本文介绍了不同线程上的异常?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

嘿! 我正在像这样使用ThreadPool

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

        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.

更多推荐

不同线程上的异常?

本文发布于:2023-11-12 12:21:50,感谢您对本站的认可!
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:线程   异常

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!