# Multithread/Background Call to increase performance

**URL:** <https://forums.unrealengine.com/t/multithread-background-call-to-increase-performance/28643>\
**Category:** C++\
**Tags:** unreal-engine\
**Created:** [April 28, 2015, 11:07am UTC](https://forums.unrealengine.com/t/multithread-background-call-to-increase-performance/28643 "2015-04-28T11:07:10Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Naocan](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Naocan](https://forums.unrealengine.com/u/Naocan)\
**Post date:** [April 28, 2015, 11:07am UTC](https://forums.unrealengine.com/t/multithread-background-call-to-increase-performance/28643/1 "2015-04-28T11:07:10Z")

</div>

Hello.

This is rather an unusual case as my researches so far yielded me only a little.

I am running a DLL on my project which gets sound from microphone for a duration(which is a parameter), processes it and returns some value(All done by the DLL). However for the duration of DLL’s execution, my game pauses as well. Since it is rather a frequent call and the game is related to timing as well, it creates an unwanted environment. The DLL call is in a blueprint library function and I need to pass some values from blueprints anyway.

My question is, is it possible to make the DLL call not to disrupt the gameplay, be done in the background and whenever it is ready, it then triggers other events and only the call of the DLL(Or the blueprint itself) is related in game? What I need is some sort of multithreading, background call, something that is completely isolated from the gameplay.

I made the same post in Reddit, and the reply was using Multithreading used in here: [A new, community-hosted Unreal Engine Wiki - Announcements and Releases - Unreal Engine Forums](https://wiki.unrealengine.com/Multi-Threading:_How_to_Create_Threads_in_UE4)

However my concern is, this is a calculation made in multithreading, but I do not really need multithreading to calculate something, I need my calculation to be done in the background so that the game is not paused in that time. Does this solution help me in this manner (The DLL is not process heavy, it only needs to record the sound and the only reason why it takes long is the duration of the sound)? If it does, am I allowed to trigger this with a blueprint and get an event when it returns the value?

In case of obscurities, I can place some screenshots/info about the details of the project.

Thanks in advance.

---

<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:** [April 28, 2015, 11:49pm UTC](https://forums.unrealengine.com/t/multithread-background-call-to-increase-performance/28643/2 "2015-04-28T23:49:16Z")

</div>

**UE4 Task Graph For Periodic Intense Calculations**

**Welcome to the forums Naocan!**

For small multi-threading tasks where you dont want to incur the overhead of creating a whole new thread, you can use UE4’s Task Graph system!

I have a different wiki on Task Graphing here:

> **[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...

```auto

**Task Graph vs New Thread**

The difference with task graphing is that it is for relatively short operations that you dont want to hang up the game thread with.

A new thread would be for things that are constantly running all game long in the background, and require continous CPU power.

```

**Great Use of Task Graph**

If you just need to periodically call fancy math functions that then set global vars that you then access from the game thread (or flip a bool to indicate you are done with the task), **then Task Graphing is a far better choice.**

I wrote a multi-threaded 3D AI navigation/pathfinding system from scratch that runs using the UE4 Task Graph system and it works great! FPS untouched!

🙂

Rama

---

<div class="post-metadata">

**Author:** ![Naocan](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Naocan](https://forums.unrealengine.com/u/Naocan)\
**Post date:** [May 6, 2015, 4:16pm UTC](https://forums.unrealengine.com/t/multithread-background-call-to-increase-performance/28643/3 "2015-05-06T16:16:23Z")

</div>

Edit: No longer revelant
