译者:LeeFJ SYMBIAN OS SDK V8.1A
--------------------------------------------------------------------------------
» Symbian OS SDK v8.1a » Symbian OS guide » Base » Using User Library (E32) » Thread And Process Management » Using Threads and Processes » Exception handling
--------------------------------------------------------------------------------
Exception handling 异常处理
When an exception occurs, such as dividing by zero or an access violation, the result depends on whether the thread has an exception handler. 当异常发生时,例如除零或非法访问,程序执行的最终结果,要看线程是否拥有一个异常处理。
If a thread has no exception handler or has an exception handler which will not handle the type of exception identified by the TExcType enumeration, then the exception is passed to the Kernel for handling. The default action is to panic the offending thread. 如果线程没有进行异常处理,或者无法处理TExcType型枚举变量所指定的异常类型,那么异常将被传递给内核处理。默认的异常处理方式就是退出那个异常发生的线程。
If a thread has an exception handler, then the handler is executed in the context of the thread on which the exception is raised; control returns to the point of exception. 如果线程具备异常处理能力,那么异常处理将在线程上下文的异常发生处开始执行;控制返回到异常发生点。
The result of an unhandled exception caused by calling RThread::RaiseException() depends on whether the exception is being raised on the caller's own thread or another thread. If a thread calls RaiseException() on itself and there is no handler for that type of exception, then a KERN-EXEC 3 panic is raised. If a thread calls RaiseException() on another thread, then that thread ends with reason code KErrDied.
调用RThread::RaiseException()方法触发一个不可处理的异常的结果,依赖于异常发生在调用者自己的线程还是另外一个线程。如果线程自身调用了RaiseException()方法,而异常处理又无法处理RaiseException()方法所触发的那种异常,然后就触发KERN-EXEC 3 异常。如果线程在另外一个线程调用RaiseException()方法,那么那个线程以错误代码KErrDied结束。
The following functions are involved in exception handling: 以下函数包括了在错误处理中所要用到的函数:
RThread::ExceptionHandler()
RThread::SetExceptionHandler()
RThread::ModifyExceptionMask()
RThread::RaiseException()
RThread::IsExceptionHandled()
-------------------------------------------------------------------------------- Copyright ©2005 Symbian Ltd. unknown-build-id
|