# UE4.8 Freezes when I kill a thread

**URL:** <https://forums.unrealengine.com/t/ue4-8-freezes-when-i-kill-a-thread/334294>\
**Category:** Programming & Scripting\
**Tags:** unreal-engine\
**Created:** [October 5, 2015, 8:43am UTC](https://forums.unrealengine.com/t/ue4-8-freezes-when-i-kill-a-thread/334294 "2015-10-05T08:43:18Z")\
**Posts on this page:** 1\
**Showing post:** 7

<div class="post-metadata">

**Author:** ![Rama](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/rama/32/882413_2.png) [@Rama](https://forums.unrealengine.com/u/Rama)\
**Post date:** [November 1, 2015, 9:11am UTC](https://forums.unrealengine.com/t/ue4-8-freezes-when-i-kill-a-thread/334294/7 "2015-11-01T09:11:15Z")

</div>

#Let the Thread complete

You should be allowing the thread to complete!

See the code in my PrimeNumber multi thread example!

> **[A new, community-hosted Unreal Engine Wiki](https://forums.unrealengine.com/t/a-new-community-hosted-unreal-engine-wiki/141494)**
>
> After over a year in maintenance mode, the official Unreal Engine Wiki is now permanently offline. These resources now live on a new community-run Unreal Engine Community Wiki — ue4community.wiki! You will be able to find content from the official...

```
void FPrimeNumberWorker::EnsureCompletion()
{
	Stop();
	Thread->WaitForCompletion();
}
 
void FPrimeNumberWorker::Shutdown()
{
	if (Runnable)
	{
		Runnable->EnsureCompletion();
		delete Runnable;
		Runnable = NULL;
	}
}

```

🙂

Rama

---

_[View the full topic](https://forums.unrealengine.com/t/ue4-8-freezes-when-i-kill-a-thread/334294)._
