# Game stay in processes after quit

**URL:** <https://forums.unrealengine.com/t/game-stay-in-processes-after-quit/478944>\
**Category:** Getting Started & Setup\
**Tags:** threads, unreal-engine, bug-report, UE4, question\
**Created:** [February 17, 2021, 6:06pm UTC](https://forums.unrealengine.com/t/game-stay-in-processes-after-quit/478944 "2021-02-17T18:06:37Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![RitorKeir](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@RitorKeir](https://forums.unrealengine.com/u/RitorKeir)\
**Post date:** [February 17, 2021, 6:06pm UTC](https://forums.unrealengine.com/t/game-stay-in-processes-after-quit/478944/1 "2021-02-17T18:06:37Z")

</div>

Hi Epic!

Our testers found a bug. Game stay in processes after exit.  
We attached to game process and found a thread which infinitely waiting the end of GPU work with samples.  
Here the code:

```
// Some samples still need the GPU to get done. Use async task to get this done...
TFunction<void()> FlushTask = [LastObjects{ MoveTemp(Objects) }]()
{
	while (1)
	{
		int32 Idx = 0;
		for (; Idx < LastObjects.Num(); ++Idx)
		{
			if (LastObjects[Idx].GPUFence.IsValid() && !LastObjects[Idx].GPUFence->Poll())
			{
				break;
			}
		}
		if (Idx == LastObjects.Num())
		{
			break;
		}

		FPlatformProcess::Sleep(5.0f / 1000.0f);
	}
};
Async(EAsyncExecution::ThreadPool, MoveTemp(FlushTask));

```

In this code the the “**LastObjects[Idx].GPUFence-\>Poll()**” always return false. And as result of infinity loop the main thread infinitely wait and can’t exit from app.

Thanks!
