Click here to Skip to main content
15,908,015 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Stack Overflow on Edit Box Pin
Gary R. Wheeler4-Jun-05 3:21
Gary R. Wheeler4-Jun-05 3:21 
GeneralRe: Stack Overflow on Edit Box Pin
Gary R. Wheeler4-Jun-05 3:36
Gary R. Wheeler4-Jun-05 3:36 
GeneralRe: Stack Overflow on Edit Box Pin
Grahamfff4-Jun-05 8:24
Grahamfff4-Jun-05 8:24 
QuestionGetting a window that uses directdraw? Pin
Programmer_4_L1f33-Jun-05 11:07
Programmer_4_L1f33-Jun-05 11:07 
AnswerRe: Getting a window that uses directdraw? Pin
Azrael.LingChen3-Jun-05 20:23
Azrael.LingChen3-Jun-05 20:23 
GeneralGraying Out Tabs in a Property Page Pin
laiju3-Jun-05 10:38
laiju3-Jun-05 10:38 
GeneralRe: Graying Out Tabs in a Property Page Pin
David Crow3-Jun-05 11:03
David Crow3-Jun-05 11:03 
GeneralNeed help resolving a deadlock Pin
Budric B.3-Jun-05 10:19
Budric B.3-Jun-05 10:19 
Hi,
I have 2 threads that for some reason lock up and I can't figure out why. Maybe if someone could look at some of my code they can see something obviously wrong:
<br />
UINT CChildView::CaptureThread()<br />
{<br />
	bool ShutterChanged = false;<br />
	int saveShutter;<br />
	while(!m_bTerminateThread)<br />
	{<br />
		//wait<br />
		if (m_bCapturePaused)<br />
		{<br />
			::SetEvent(m_hCapturePausedConfirm);<br />
			switch(::WaitForSingleObject(m_hCaptureEvent, 5000))<br />
			{<br />
				case WAIT_OBJECT_0:<br />
					break;                //break out of the switch statement<br />
				case WAIT_TIMEOUT:<br />
					continue;             //continue with the switch statement<br />
			}<br />
		}<br />
...rest of the thread<br />
Note that inside this thread I use an object which implements CCriticalSection object that I lock and unlock for each function.  Both the GUI thread and this thread calls functions on this object.<br />
}<br />
Furthermore I define:<br />
	inline void StartCapture()<br />
	{<br />
		m_bCapturePaused = FALSE;<br />
		::SetEvent(m_hCaptureEvent);<br />
		::ResetEvent(m_hCapturePausedConfirm);<br />
	}<br />
	inline void PauseCapture()<br />
	{<br />
		m_bCapturePaused = TRUE;<br />
		::ResetEvent(m_hCaptureEvent);<br />
		::WaitForSingleObject(m_hCapturePausedConfirm, INFINITE);<br />
	}<br />


The problem is in the main program when the user clicks a button I want to pause the thread. The deadlock doesn't occur always. Also any runs through the debugger work, so I don't know how to solve this problem.

Thanks.
GeneralRe: Just found the problem Pin
Budric B.3-Jun-05 11:02
Budric B.3-Jun-05 11:02 
GeneralRe: Just found the problem Pin
Blake Miller3-Jun-05 11:08
Blake Miller3-Jun-05 11:08 
GeneralA question about CBT hook Pin
Gaetano Sferra3-Jun-05 9:10
Gaetano Sferra3-Jun-05 9:10 
GeneralRe: A question about CBT hook Pin
Nilesh K.5-Jun-05 23:32
Nilesh K.5-Jun-05 23:32 
GeneralRe: A question about CBT hook Pin
Gaetano Sferra6-Jun-05 0:44
Gaetano Sferra6-Jun-05 0:44 
GeneralRe: A question about CBT hook Pin
Nilesh K.6-Jun-05 16:43
Nilesh K.6-Jun-05 16:43 
GeneralRe: A question about CBT hook Pin
Gaetano Sferra6-Jun-05 21:23
Gaetano Sferra6-Jun-05 21:23 
GeneralNeed help converting this inline asm cosf function for use in a gnu compiler Pin
FocusedWolf3-Jun-05 8:36
FocusedWolf3-Jun-05 8:36 
GeneralRe: Need help converting this inline asm cosf function for use in a gnu compiler Pin
Chris Losinger3-Jun-05 8:54
professionalChris Losinger3-Jun-05 8:54 
GeneralRe: Need help converting this inline asm cosf function for use in a gnu compiler Pin
FocusedWolf3-Jun-05 11:08
FocusedWolf3-Jun-05 11:08 
QuestionHow to know whether a device is connected to my USB port or not Pin
anukampa3-Jun-05 4:58
anukampa3-Jun-05 4:58 
AnswerRe: How to know whether a device is connected to my USB port or not Pin
Trollslayer3-Jun-05 13:14
mentorTrollslayer3-Jun-05 13:14 
AnswerRe: How to know whether a device is connected to my USB port or not Pin
FlyingTinman3-Jun-05 14:36
FlyingTinman3-Jun-05 14:36 
GeneralCComboBox selection state before CBN_SELCHANGE Pin
stevy823-Jun-05 4:24
stevy823-Jun-05 4:24 
GeneralRe: CComboBox selection state before CBN_SELCHANGE Pin
David Crow3-Jun-05 5:28
David Crow3-Jun-05 5:28 
GeneralMonitoring opened files Pin
0908869039@seznam.cz3-Jun-05 3:37
0908869039@seznam.cz3-Jun-05 3:37 
GeneralRe: Monitoring opened files Pin
David Crow3-Jun-05 4:03
David Crow3-Jun-05 4:03 

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.