Announcement

Collapse
No announcement yet.

Thread/Async implementation question

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Thread/Async implementation question

    Hello, I am new to UE and have more of Unity/C# background, so I tend more to blueprint coding and minimum implementation in C++.

    So one part of the project that I think must be implemented in C++ is to read data from virtual COM port.
    Device is writing delta values to serial port at its own rate (~1000ticks/sec). So I need to have code running in separate thread that parses data from COM port and adds it to accumulated value. This code can be started from game code at some "BeginPlay" event.

    Then from game thread I need to access accumulated by that thread data and reset that accumulated data to zeroes, so that I can have maximum up to date sum of deltas for each Game Tick event.
    As I understand from C# perspective for such access I need to somehow lock accumulated data or pause "port reader" thread so it doesn't try to access data while game thread is reading and zeroing it.

    From what I found so far I should use either Async/Future feature as described here https://forums.unrealengine.com/show...ranch-and-4-8) or multi-threading implementation as described here https://wiki.unrealengine.com/Multi-...Threads_in_UE4 .
    As I still not fluent in C++ it is hard for me to precisely understand difference between them, so I ask if someone can suggest or point to good example.
Working...
X