Click here to Skip to main content
15,906,626 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: No Windows xp visual styles in VC++ 2003 Pin
Mark Salsbery11-May-07 6:22
Mark Salsbery11-May-07 6:22 
QuestionBreaking out of a blocking function...[Threads] Pin
Eytukan11-May-07 5:23
Eytukan11-May-07 5:23 
AnswerRe: Breaking out of a blocking function...[Threads] Pin
CPallini11-May-07 5:34
mveCPallini11-May-07 5:34 
GeneralRe: Breaking out of a blocking function...[Threads] Pin
Eytukan11-May-07 5:39
Eytukan11-May-07 5:39 
GeneralRe: Breaking out of a blocking function...[Threads] Pin
CPallini11-May-07 9:28
mveCPallini11-May-07 9:28 
GeneralRe: Breaking out of a blocking function...[Threads] Pin
Roger Stoltz11-May-07 9:43
Roger Stoltz11-May-07 9:43 
GeneralRe: Breaking out of a blocking function...[Threads] Pin
Eytukan11-May-07 23:14
Eytukan11-May-07 23:14 
GeneralRe: Breaking out of a blocking function...[Threads] Pin
Stephen Hewitt11-May-07 21:29
Stephen Hewitt11-May-07 21:29 
Calling TerminateThread for this function is a sin in Win32 (with barely any exceptions). See here[^] and here[^] here for details. Quote from MSDN:
TerminateThread is a dangerous function that should only be used in the most extreme cases. You should call TerminateThread only if you know exactly what the target thread is doing, and you control all of the code that the target thread could possibly be running at the time of the termination. For example, TerminateThread can result in the following problems:
- If the target thread owns a critical section, the critical section will not be released.
- If the target thread is allocating memory from the heap, the heap lock will not be released.
- If the target thread is executing certain kernel32 calls when it is terminated, the kernel32 state for the thread's process could be inconsistent.
- If the target thread is manipulating the global state of a shared DLL, the state of the DLL could be destroyed, affecting other users of the DLL.


This is one of the most frequent and serious mistakes Win32 programmers make. It creates a class of bug that's very hard to track down and is non-determinisitc.

Steve

GeneralRe: Breaking out of a blocking function...[Threads] Pin
CPallini12-May-07 1:08
mveCPallini12-May-07 1:08 
GeneralRe: Breaking out of a blocking function...[Threads] Pin
Daniel Grunwald13-May-07 2:59
Daniel Grunwald13-May-07 2:59 
GeneralRe: Breaking out of a blocking function...[Threads] Pin
CPallini13-May-07 10:38
mveCPallini13-May-07 10:38 
GeneralRe: Breaking out of a blocking function...[Threads] Pin
Stephen Hewitt13-May-07 14:04
Stephen Hewitt13-May-07 14:04 
GeneralRe: Breaking out of a blocking function...[Threads] Pin
CPallini13-May-07 21:15
mveCPallini13-May-07 21:15 
GeneralRe: Breaking out of a blocking function...[Threads] Pin
Stephen Hewitt13-May-07 14:01
Stephen Hewitt13-May-07 14:01 
GeneralRe: Breaking out of a blocking function...[Threads] Pin
CPallini13-May-07 21:05
mveCPallini13-May-07 21:05 
GeneralRe: Breaking out of a blocking function...[Threads] Pin
Stephen Hewitt13-May-07 21:23
Stephen Hewitt13-May-07 21:23 
GeneralRe: Breaking out of a blocking function...[Threads] Pin
CPallini13-May-07 21:35
mveCPallini13-May-07 21:35 
GeneralRe: Breaking out of a blocking function...[Threads] Pin
Stephen Hewitt13-May-07 21:37
Stephen Hewitt13-May-07 21:37 
GeneralRe: Breaking out of a blocking function...[Threads] Pin
CPallini13-May-07 21:55
mveCPallini13-May-07 21:55 
GeneralRe: Breaking out of a blocking function...[Threads] Pin
Stephen Hewitt13-May-07 22:19
Stephen Hewitt13-May-07 22:19 
GeneralRe: Breaking out of a blocking function...[Threads] Pin
CPallini13-May-07 22:24
mveCPallini13-May-07 22:24 
GeneralRe: Breaking out of a blocking function...[Threads] Pin
Stephen Hewitt13-May-07 22:28
Stephen Hewitt13-May-07 22:28 
GeneralRe: Breaking out of a blocking function...[Threads] Pin
CPallini13-May-07 22:37
mveCPallini13-May-07 22:37 
GeneralRe: Breaking out of a blocking function...[Threads] Pin
Stephen Hewitt13-May-07 22:44
Stephen Hewitt13-May-07 22:44 
GeneralRe: Breaking out of a blocking function...[Threads] Pin
CPallini14-May-07 9:13
mveCPallini14-May-07 9:13 

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.