Click here to Skip to main content
15,893,668 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: String literal expansion Pin
Michael Dunn5-Sep-08 8:07
sitebuilderMichael Dunn5-Sep-08 8:07 
AnswerRe: String literal expansion Pin
Garth J Lancaster5-Sep-08 15:00
professionalGarth J Lancaster5-Sep-08 15:00 
Questionhow to read data from com port Pin
manju23reddy5-Sep-08 7:40
manju23reddy5-Sep-08 7:40 
QuestionVC++ and CRystalReport Pin
kasi145-Sep-08 7:39
kasi145-Sep-08 7:39 
AnswerRe: VC++ and CRystalReport Pin
liquid_6-Sep-08 10:48
liquid_6-Sep-08 10:48 
QuestionThreads Pin
bhanu_85095-Sep-08 3:35
bhanu_85095-Sep-08 3:35 
AnswerRe: Threads Pin
David Crow5-Sep-08 3:53
David Crow5-Sep-08 3:53 
AnswerRe: Threads Pin
JudyL_MD5-Sep-08 4:38
JudyL_MD5-Sep-08 4:38 
Why are you using TerminateThread when you already appear to have a signalling mechanism in place with pTSRecording->file_rec? To quote 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.


Since you have an event already and your thread's while loop is testing the event's state, simply signal the event in your CloseRecord function and then WaitForSingleObject (hRecording). This will neatly and completely and correctly shut down your thread. TerminateThread can mess up a system so much, it could be the reason your window won't close since the window and thread are interacting with each other.

Judy
GeneralRe: Threads Pin
bhanu_85096-Sep-08 0:12
bhanu_85096-Sep-08 0:12 
GeneralRe: Threads Pin
JudyL_MD6-Sep-08 2:46
JudyL_MD6-Sep-08 2:46 
AnswerRe: Threads Pin
Roger Stoltz5-Sep-08 4:42
Roger Stoltz5-Sep-08 4:42 
QuestionHow can Extract String ? Pin
Le@rner5-Sep-08 2:54
Le@rner5-Sep-08 2:54 
AnswerRe: How can Extract String ? Pin
_AnsHUMAN_ 5-Sep-08 2:57
_AnsHUMAN_ 5-Sep-08 2:57 
GeneralRe: How can Extract String ? Pin
toxcct5-Sep-08 3:07
toxcct5-Sep-08 3:07 
GeneralRe: How can Extract String ? Pin
_AnsHUMAN_ 5-Sep-08 3:20
_AnsHUMAN_ 5-Sep-08 3:20 
GeneralRe: How can Extract String ? Pin
toxcct5-Sep-08 3:37
toxcct5-Sep-08 3:37 
AnswerRe: How can Extract String ? Pin
Michael Dunn5-Sep-08 8:24
sitebuilderMichael Dunn5-Sep-08 8:24 
GeneralRe: How can Extract String ? Pin
Jerry Jeremiah7-Sep-08 11:21
Jerry Jeremiah7-Sep-08 11:21 
Questionuuid operator Pin
George_George5-Sep-08 2:15
George_George5-Sep-08 2:15 
AnswerRe: uuid operator Pin
_AnsHUMAN_ 5-Sep-08 2:56
_AnsHUMAN_ 5-Sep-08 2:56 
GeneralRe: uuid operator Pin
George_George7-Sep-08 17:23
George_George7-Sep-08 17:23 
AnswerRe: uuid operator Pin
cmk5-Sep-08 3:54
cmk5-Sep-08 3:54 
GeneralRe: uuid operator Pin
George_George7-Sep-08 17:20
George_George7-Sep-08 17:20 
QuestionA C++ Question Pin
False Chicken5-Sep-08 2:13
False Chicken5-Sep-08 2:13 
AnswerRe: A C++ Question Pin
Nibu babu thomas5-Sep-08 2:15
Nibu babu thomas5-Sep-08 2:15 

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.