Source/SeptemServo/Threads/ListenThread.cpp
bool FListenThread::KillThread()
{
	bool bDidExit = true;

	TimeToDie = true;

	if (nullptr != Thread)
	{
		// Trigger the thread so that it will come out of the wait state if
		// it isn't actively doing work
		//if(event) event->Trigger();

		Stop();

		// If waiting was specified, wait the amount of time. If that fails,
		// brute force kill that thread. Very bad as that might leak.
		Thread->WaitForCompletion();	//block call

		// Clean up the event
		// if(event) FPlatformProcess::ReturnSynchEventToPool(event);
		// event = nullptr;

		// here will call Stop()
		delete Thread;
		Thread = nullptr;

		// socket had been safe release in exit();
	}

	return bDidExit;
}
/**
 * Tells the thread to exit. If the caller needs to know when the thread
 * has exited, it should use the bShouldWait value and tell it how long
 * to wait before deciding that it is deadlocked and needs to be destroyed.
 * NOTE: having a thread forcibly destroyed can cause leaks in TLS, etc.
 *
 * @return True if the thread exited graceful, false otherwise
 */
Tells the thread to exit. If the caller needs to know when the thread
has exited, it should use the bShouldWait value and tell it how long
to wait before deciding that it is deadlocked and needs to be destroyed.
NOTE: having a thread forcibly destroyed can cause leaks in TLS, etc.

@return True if the thread exited graceful, false otherwise
Tells the thread to exit . If the caller needs to know when the thread has exited it should use the bShouldWait value and tell it how long to wait before deciding that it is deadlocked and needs to be destroyed . NOTE : having a thread forcibly destroyed can cause leaks in TLS etc . @return True if the thread exited graceful false otherwise
bool FListenThread::KillThread()
{
	bool bDidExit = true;
	TimeToDie = true;
	if (nullptr != Thread)
	{
		Stop();
		Thread->WaitForCompletion();	
		delete Thread;
		Thread = nullptr;
	}
	return bDidExit;
}
bool FListenThread :: KillThread ( ) { bool bDidExit = true ; TimeToDie = true ; if ( nullptr != Thread ) { Stop ( ) ; Thread -> WaitForCompletion ( ) ; delete Thread ; Thread = nullptr ; } return bDidExit ; }
Tells the thread to exit.
Tells the thread to exit .
// Trigger the thread so that it will come out of the wait state if // it isn't actively doing work //if(event) event->Trigger(); // If waiting was specified, wait the amount of time. If that fails, // brute force kill that thread. Very bad as that might leak. //block call // Clean up the event // if(event) FPlatformProcess::ReturnSynchEventToPool(event); // event = nullptr; // here will call Stop() // socket had been safe release in exit();