# FAutoDeleteAsyncTask start background on specified queue

**URL:** <https://forums.unrealengine.com/t/fautodeleteasynctask-start-background-on-specified-queue/311915>\
**Category:** Programming & Scripting\
**Tags:** unreal-engine\
**Created:** [March 20, 2015, 8:53pm UTC](https://forums.unrealengine.com/t/fautodeleteasynctask-start-background-on-specified-queue/311915 "2015-03-20T20:53:31Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_0abc0bce](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_0abc0bce](https://forums.unrealengine.com/u/anonymous_user_0abc0bce)\
**Post date:** [March 20, 2015, 8:53pm UTC](https://forums.unrealengine.com/t/fautodeleteasynctask-start-background-on-specified-queue/311915/1 "2015-03-20T20:53:31Z")

</div>

In FAsyncTask, the StartBackgroundTask allows to specify the actual parameter of the thread pool to run the task on. FAutoDeleteAsyncTask misses this feature.

I’ve attached a patch that mitigates this problem; it reuses the implementation of FAsyncTask. I was unable to use GitHub’s pull requests. Has Epic a dedicated email address for mailing such patches, without cluttering AnswerHub?

Regards,

[HyperReuts Technologic](http://www.hyperreuts.com)

```
From 94327fee65f1606bc2ddcb36bfbb65b2086fa6dd Mon Sep 17 00:00:00 2001
From: Praalhans <praalhans@users.noreply.github.com>
Date: Fri, 20 Mar 2015 21:27:03 +0100
Subject: [PATCH] Adds same capability to pick FQueuedThreadPool when starting
 background thread as FAsyncTask to FAutoDeleteAsyncTask.

Signed-off-by: Praalhans <praalhans@users.noreply.github.com>
---
 Engine/Source/Runtime/Core/Public/Async/AsyncWork.h | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/Engine/Source/Runtime/Core/Public/Async/AsyncWork.h b/Engine/Source/Runtime/Core/Public/Async/AsyncWork.h
index 7c48f27..becb2b8 100644
--- a/Engine/Source/Runtime/Core/Public/Async/AsyncWork.h
+++ b/Engine/Source/Runtime/Core/Public/Async/AsyncWork.h
@@ -51,10 +51,10 @@ class FAutoDeleteAsyncTask : private FQueuedWork
 	/* Generic start function, not called directly
 		* @param bForceSynchronous if true, this job will be started synchronously, now, on this thread
 	**/
-	void Start(bool bForceSynchronous)
+	void Start(bool bForceSynchronous, FQueuedThreadPool* InQueuedPool)
 	{
 		FPlatformMisc::MemoryBarrier();
- FQueuedThreadPool* QueuedPool = GThreadPool;
+ FQueuedThreadPool* QueuedPool = InQueuedPool;
 		if (bForceSynchronous)
 		{
 			QueuedPool = 0;
@@ -174,11 +174,11 @@ public:
 	}
 
 	/** 
-	* Run this task on the lo priority thread pool. It is not safe to use this object after this call.
+	* Run this task on the low priority thread pool, or the specified thread pool. It is not safe to use this object after this call.
 	**/
-	void StartBackgroundTask()
+	void StartBackgroundTask(FQueuedThreadPool* InQueuedPool = GThreadPool)
 	{
- Start(false);
+ Start(false, InQueuedPool);
 	}
 
 };
-- 
1.9.5.msysgit.1

```
