Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
408 views
in Technique[技术] by (71.8m points)

c# - Why am I seeing multiple "The thread 0x22c8 has exited with code 259 (0x103)." messages

I'm getting a slew of these messages in my Winforms application even though I never explicitly made any threads. Why is this happening? I've looked around for an explanation but it's hard to word an inquiry like this.

I'm using Visual Studios 2013 and this is the debug output that I'm concerned about:

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).
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

From MSDN Documentation:

Remarks

This function returns immediately. If the specified thread has not terminated and the function succeeds, the status returned is STILL_ACTIVE. If the thread has terminated and the function succeeds, the status returned is one of the following values: The exit value specified in the ExitThread or TerminateThread function. The return value from the thread function. The exit value of the thread's process. Important The GetExitCodeThread function returns a valid error code defined by the application only after the thread terminates. Therefore, an application should not use STILL_ACTIVE (259) as an error code. If a thread returns STILL_ACTIVE (259) as an error code, applications that test for this value could interpret it to mean that the thread is still running and continue to test for the completion of the thread after the thread has terminated, which could put the application into an infinite loop.

So basically it's still checking current thread from time to time.

It seems to be a bug:

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...