繁体   English   中英

为什么我看到多个“线程 0x22c8 已退出,代码为 259 (0x103)”。 消息

[英]Why am I seeing multiple “The thread 0x22c8 has exited with code 259 (0x103).” messages

尽管我从未明确创建任何线程,但我在我的 Winforms 应用程序中收到了大量这些消息。 为什么会这样? 我四处寻找解释,但很难说出这样的询问。

我正在使用 Visual Studios 2013,这是我关心的调试输出:

The thread 0x23a4 has exited with code 259 (0x103).
The thread 0x2884 has exited with code 259 (0x103).
The thread 0x27ec has exited with code 259 (0x103).
The thread 0x1978 has exited with code 259 (0x103).
The thread 0x1534 has exited with code 259 (0x103).
The thread 0x1ad8 has exited with code 259 (0x103).
The thread 0x2938 has exited with code 259 (0x103).
The thread 0x22c8 has exited with code 259 (0x103).

来自 MSDN 文档:

评论

该函数立即返回。 如果指定线程未终止且函数成功,则返回状态为 STILL_ACTIVE。 如果线程已终止并且函数成功,则返回的状态为以下值之一: ExitThread 或 TerminateThread 函数中指定的退出值。 线程函数的返回值。 线程进程的退出值。 重要 GetExitCodeThread 函数仅在线程终止后返回由应用程序定义的有效错误代码。 因此,应用程序不应使用 STILL_ACTIVE (259) 作为错误代码。 如果线程返回 STILL_ACTIVE (259) 作为错误代码,则测试此值的应用程序可能会将其解释为线程仍在运行并在线程终止后继续测试线程是否完成,这可能会导致应用进入无限循环。

所以基本上它仍然不时检查当前线程。

这似乎是一个错误:

http://connect.microsoft.com/VisualStudio/feedback/details/812144/vs2013-reports-incorrect-thread-exit-code

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM