Click here to Skip to main content
15,908,768 members
Home / Discussions / C#
   

C#

 
GeneralRe: Threads in Windows service Pin
RoyceF1-May-08 11:06
RoyceF1-May-08 11:06 
<br />
void CFileChangeEvent::stopProcessThread()<br />
{<br />
	TRACE( "> > > > CFileChangeEvent::stopProcessThread() entered - Event handles < %X, %X >, Event ID < %s >\n",<br />
					m_hProcessStopEvent, m_hProcessRespEvent, getIdentifier() );<br />
<br />
	//	The ProcessStopEvent is used by the main thread to tell the worker thread to stop. <br />
	//	In turn, the worker thread sets the ProcessRespEvent to tell the main thread that it has stopped. <br />
	::SetEvent( m_hProcessStopEvent );<br />
}<br />
<br />
UINT CFileChangeEvent::workerThread( LPVOID lpParam )<br />
{<br />
	CFileChangeEvent* pEvent = (CFileChangeEvent*)lpParam;<br />
	HANDLE hProcessStopEvent = pEvent->getProcessStopEvent();<br />
<br />
	for( ; iterFile != vecFifFiles.end()  &&  ! bCancelled;<br />
			iterFile++ )<br />
	{<br />
		Do some work here<br />
<br />
<br />
		DWORD dwWaitStatus = ::WaitForSingleObject( hProcessStopEvent, 1 ); <br />
		if ( dwWaitStatus == WAIT_FAILED )<br />
		{<br />
			TRACE( "> > > > CFileChangeEvent::workerThread() - ::WaitForSingleObject() failed - Event handle < %X >\n",<br />
							hProcessStopEvent );<br />
			bCancelled = true;<br />
		}<br />
		else if ( dwWaitStatus == WAIT_OBJECT_0 )<br />
			bCancelled = true;<br />
	}<br />
}<br />


Thanks for your help.
GeneralRe: Threads in Windows service Pin
Gareth H1-May-08 11:19
Gareth H1-May-08 11:19 
GeneralRe: Threads in Windows service Pin
RoyceF1-May-08 11:36
RoyceF1-May-08 11:36 
GeneralRe: Threads in Windows service Pin
RoyceF1-May-08 11:27
RoyceF1-May-08 11:27 
GeneralRe: Threads in Windows service Pin
RoyceF1-May-08 11:40
RoyceF1-May-08 11:40 
QuestionWindows Mobile 5 - moving selected form items up when osk activated Pin
Spacedmc1-May-08 7:57
Spacedmc1-May-08 7:57 
AnswerRe: Windows Mobile 5 - moving selected form items up when osk activated Pin
Arjun Marwaha1-May-08 11:30
Arjun Marwaha1-May-08 11:30 
Questionimport/Export Xml into a hastable Pin
Member 40084921-May-08 6:18
Member 40084921-May-08 6:18 
AnswerRe: import/Export Xml into a hastable Pin
Gareth H1-May-08 7:55
Gareth H1-May-08 7:55 
AnswerRe: import/Export Xml into a hastable Pin
Anthony Mushrow1-May-08 8:12
professionalAnthony Mushrow1-May-08 8:12 
Questionyield return Pin
George_George1-May-08 4:23
George_George1-May-08 4:23 
AnswerRe: yield return Pin
led mike1-May-08 4:41
led mike1-May-08 4:41 
GeneralRe: yield return Pin
George_George1-May-08 4:45
George_George1-May-08 4:45 
GeneralRe: yield return Pin
User 66581-May-08 6:32
User 66581-May-08 6:32 
GeneralRe: yield return Pin
George_George1-May-08 21:58
George_George1-May-08 21:58 
GeneralRe: yield return Pin
Simon P Stevens1-May-08 9:42
Simon P Stevens1-May-08 9:42 
GeneralRe: yield return Pin
George_George1-May-08 21:57
George_George1-May-08 21:57 
GeneralRe: yield return Pin
Simon P Stevens2-May-08 9:33
Simon P Stevens2-May-08 9:33 
GeneralRe: yield return Pin
George_George2-May-08 21:24
George_George2-May-08 21:24 
Question1-Wire iButtons [modified] Pin
MarkB7771-May-08 3:32
MarkB7771-May-08 3:32 
QuestionFinalization and Performance Pin
George_George1-May-08 3:20
George_George1-May-08 3:20 
AnswerRe: Finalization and Performance Pin
Christian Graus1-May-08 3:34
protectorChristian Graus1-May-08 3:34 
GeneralRe: Finalization and Performance Pin
George_George1-May-08 3:47
George_George1-May-08 3:47 
GeneralRe: Finalization and Performance Pin
Christian Graus1-May-08 3:56
protectorChristian Graus1-May-08 3:56 
GeneralRe: Finalization and Performance Pin
George_George1-May-08 4:10
George_George1-May-08 4:10 

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.