flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
JohnFound 23 Dec 2010, 14:55
Actually you don't have to call TerminateThread always. If the thread ends normally, there is no reason to call TerminateThread.
You should use WaitForSingleObject only when you have to wait for thread to finish it's job. For example, if the main thread can't continue without the result of the thread. If you wait always it is useless to use thread - you can do the job in the main thread, instead of waiting. |
|||
![]() |
|
revolution 23 Dec 2010, 15:08
JohnFound wrote: For example, if the main thread can't continue without the result of the thread. If you wait always it is useless to use thread - you can do the job in the main thread, instead of waiting. |
|||
![]() |
|
ouadji 23 Dec 2010, 15:13
Quote:
Here is a sentence that perfectly explains the usefulness of this function. perfect, I understood. Thank you very much JohnFound Quote:
I also understand that. thank you revolution. (there is no synchronization in my case) |
|||
![]() |
|
b1528932 23 Dec 2010, 20:54
when you create thread, you must take responsibility for it, by for example registering waitforsingleobject. Thread that created child thread must be notyfied when it exitted (was killed?). You shouldnt just spawn thread and forget about it, hoping it will complete a job. When you write multithreaded app, 1 thread is always main thread wich only watch over its children and manage them,
|
|||
![]() |
|
Igor1024 24 Dec 2010, 06:37
Actually, "TerminateThread" function is rather bad for using, cause it can lead to leaks (read Jeffrey Richter ).
|
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.