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,
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