Click here to Skip to main content
15,903,362 members
Home / Discussions / .NET (Core and Framework)
   

.NET (Core and Framework)

 
AnswerRe: hello Pin
Eddy Vluggen9-Apr-09 10:47
professionalEddy Vluggen9-Apr-09 10:47 
AnswerRe: hello Pin
led mike9-Apr-09 10:56
led mike9-Apr-09 10:56 
GeneralRe: hello Pin
Pete O'Hanlon12-Apr-09 11:03
mvePete O'Hanlon12-Apr-09 11:03 
QuestionSafe thread termination in unmanaged code Pin
supercat99-Apr-09 8:06
supercat99-Apr-09 8:06 
AnswerRe: Safe thread termination in unmanaged code Pin
led mike9-Apr-09 9:10
led mike9-Apr-09 9:10 
GeneralRe: Safe thread termination in unmanaged code Pin
supercat99-Apr-09 9:44
supercat99-Apr-09 9:44 
GeneralRe: Safe thread termination in unmanaged code Pin
led mike9-Apr-09 10:55
led mike9-Apr-09 10:55 
GeneralRe: Safe thread termination in unmanaged code Pin
supercat99-Apr-09 11:43
supercat99-Apr-09 11:43 
I imagine the author talking about dangers is addressing production software environments.

The system might get used in something between a testing and production environment; the actual hardware device includes the ability to initiate TCP connections to a server, and it's possible that customers might use the "simulator" to simulate having a number of devices connecting to the server at once. By the time the code gets to the customer it shouldn't get into bad situations, but in case something bad happens (e.g. the server comes back with a response that would confuse the device) it would be nicer to allow a controlled shutdown of the thread than to force the user to kill the application.

I guess my main question should perhaps have been better phrased as, "The documentation says to avoid using TerminateThread; is there any accepted style for wrapping it in those circumstances where its use may be reasonably safe and appropriate?" I guess if there's no way to recover the stack in older versions of Windows that would be bad, but it could still be better than having a stuck thread gobble up all the CPU time it can get.

On a related note, under what circumstances is an "isBackground" thread killed off blindly when an application terminates? If a thread is doing a "WriteAllText" to create and write a file, is the function guaranteed to either fail altogether or succeed completely in case of application termination, or should it be surrounded by saving the isBackground property of the current thread, setting it to False, performing the function, and restoring the old value of isBackground?

In any case, thanks for responding. -- John
GeneralRe: Safe thread termination in unmanaged code Pin
Luc 64801110-Apr-09 2:57
Luc 64801110-Apr-09 2:57 
GeneralRe: Safe thread termination in unmanaged code Pin
led mike10-Apr-09 5:37
led mike10-Apr-09 5:37 
Questionam i a programmer or not [modified] Pin
rilm9-Apr-09 7:48
rilm9-Apr-09 7:48 
AnswerRe: am i a programmer or not Pin
Paulo Zemek9-Apr-09 8:19
Paulo Zemek9-Apr-09 8:19 
GeneralRe: am i a programmer or not Pin
led mike9-Apr-09 8:41
led mike9-Apr-09 8:41 
GeneralRe: am i a programmer or not Pin
dojohansen15-Apr-09 1:40
dojohansen15-Apr-09 1:40 
GeneralRe: am i a programmer or not Pin
led mike15-Apr-09 11:49
led mike15-Apr-09 11:49 
GeneralRe: am i a programmer or not Pin
dojohansen16-Apr-09 0:44
dojohansen16-Apr-09 0:44 
GeneralRe: am i a programmer or not Pin
led mike16-Apr-09 5:18
led mike16-Apr-09 5:18 
GeneralRe: am i a programmer or not Pin
dojohansen16-Apr-09 5:29
dojohansen16-Apr-09 5:29 
GeneralRe: am i a programmer or not Pin
led mike16-Apr-09 7:30
led mike16-Apr-09 7:30 
AnswerRe: am i a programmer or not Pin
led mike9-Apr-09 8:43
led mike9-Apr-09 8:43 
GeneralRe: am i a programmer or not Pin
rilm11-Apr-09 11:22
rilm11-Apr-09 11:22 
AnswerRe: am i a programmer or not Pin
Eddy Vluggen9-Apr-09 10:03
professionalEddy Vluggen9-Apr-09 10:03 
AnswerRe: am i a programmer or not Pin
Anubhava Dimri10-Apr-09 23:24
Anubhava Dimri10-Apr-09 23:24 
AnswerRe: am i a programmer or not Pin
je_gonzalez12-Apr-09 21:55
je_gonzalez12-Apr-09 21:55 
GeneralRe: am i a programmer or not Pin
dojohansen15-Apr-09 1:48
dojohansen15-Apr-09 1:48 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.