HexEdit/BGPreview.cpp
// Check for a stop scanning (or kill) of the background thread

Check for a stop scanning (or kill) of the background thread
Check for a stop scanning ( or kill ) of the background thread
bool CHexEditDoc::PreviewProcessStop()
{
	bool retval = false;
	CSingleLock sl(&docdata_, TRUE);
	switch(preview_command_)
	{
	case STOP:                      
		TRACE1("+++ BGPreview: stop for %p\n", this);
		retval = true;
		break;
	case DIE:                       
		TRACE1("+++ BGPreview: killed thread for %p\n", this);
		preview_state_ = DYING;
		sl.Unlock();                
		AfxEndThread(1);            
		break;                      
	case NONE:                      
		break;
	default:                        
		ASSERT(0);
	}
	preview_command_ = NONE;
	return retval;
}
bool CHexEditDoc :: PreviewProcessStop ( ) { bool retval = false ; CSingleLock sl ( & docdata_ , TRUE ) ; switch ( preview_command_ ) { case STOP : TRACE1 ( " \n " , this ) ; retval = true ; break ; case DIE : TRACE1 ( " \n " , this ) ; preview_state_ = DYING ; sl . Unlock ( ) ; AfxEndThread ( 1 ) ; break ; case NONE : break ; default : ASSERT ( 0 ) ; } preview_command_ = NONE ; return retval ; }
Check for a stop scanning (or kill) of the background thread
Check for a stop scanning ( or kill ) of the background thread
// stop scan and wait
 // terminate this thread
 // we need this here as AfxEndThread() never returns so d'tor is not called
 // kills thread (no return)
 // Avoid warning
 // nothing needed here - just continue scanning
 // should not happen
 // Prevent reprocessing of the same command
