# Thread safe manipulation of game play objects/actors

**URL:** <https://forums.unrealengine.com/t/thread-safe-manipulation-of-game-play-objects-actors/57181>\
**Category:** C++\
**Tags:** unreal-engine\
**Created:** [March 3, 2016, 9:06pm UTC](https://forums.unrealengine.com/t/thread-safe-manipulation-of-game-play-objects-actors/57181 "2016-03-03T21:06:26Z")\
**Posts on this page:** 1\
**Showing post:** 3

<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:** [March 7, 2016, 6:16pm UTC](https://forums.unrealengine.com/t/thread-safe-manipulation-of-game-play-objects-actors/57181/3 "2016-03-07T18:16:27Z")

</div>

**Actually There Must Be a Way**

On second thought there must be a way to safely send message to Blueprints, because I am doing it via a UDP Socket thread in this wiki tutorial:

> **[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 — https://unrealcommunity.wiki/! You will be able to find content from...

If you use a delegate that is sending threadsafe data you should be fine

[//UdpSocketReceiver.h](https://UdpSocketReceiver.h)

```auto

/**
 * Asynchronously receives data from an UDP socket.
 */
class FUdpSocketReceiver
	: public FRunnable

```

```auto

/**
 * Temporary fix for concurrency crashes. This whole class will be redesigned.
 */
typedef TSharedPtr<FArrayReader, **ESPMode::ThreadSafe** > FArrayReaderPtr;

/**
 * Delegate type for received data.
 *
 * The first parameter is the received data.
 * The second parameter is sender's IP endpoint.
 */
DECLARE_DELEGATE_TwoParams(FOnSocketDataReceived, const FArrayReaderPtr&, const FIPv4Endpoint&);

```

I will go do some testing. 🙂

Okay my testing results:

If I use a wait time with thread safe data before sending to BP, it works great.

But if I just let the thread go full throttle than it crashes Blueprints pretty quick.

Have you tried simply adding a wait time to your thread?

**Even a wait time of 0.01 is not crashing.**

0.001 or 0.0001 does crash though 🙂

That will still have advantages over using game thread, even if the other thread is not running at infinite speeds.

You can try sleeping for various numbers of seconds, putting this inside your Run() (ensuring it will slow down whenever you are sending a message to BP)

```auto

FPlatformProcess::Sleep(seconds);

```

❤

---

_[View the full topic](https://forums.unrealengine.com/t/thread-safe-manipulation-of-game-play-objects-actors/57181)._
