x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Returning values from another thread

Basically I am trying to make a function that takes parameters on another thread because it is relatively expensive, then return an output value to the game thread I found Rama's wiki thread very helpful (https://wiki.unrealengine.com/Multi-Threading:_How_to_Create_Threads_in_UE4) but it did not cover how to get the values calculated back to the game thread.

How would I go about this?

Product Version: Not Selected
Tags:
more ▼

asked Aug 25 '14 at 11:24 PM in C++ Programming

avatar image

GuapoTaco101
55 14 13 14

avatar image GuapoTaco101 Aug 27 '14 at 11:54 PM

Anybody? I really need help on this!

avatar image silentkratos Mar 07 '15 at 10:33 AM

How did you get it working? Can I see your code?

(comments are locked)
10|2000 characters needed characters left

1 answer: sort voted first

If you look at this section of my tutorial

https://wiki.unrealengine.com/Multi-Threading:_How_to_Create_Threads_in_UE4#Starting_the_thread

The TArray is actually stored in the pc class, just avoid accessing it in the game thread until the other thread has finished filling it!

and never use ranged for loops when doing fancy stuff like this, use the standard for loop, so you check the length each time :)

Rama

more ▼

answered Aug 28 '14 at 07:07 PM

avatar image

Rama
10.5k 443 340 1078

avatar image GuapoTaco101 Aug 29 '14 at 12:53 PM

Sorry silly question, but I am new to all this. Because the thread variable is private, I can't use the Thread->EnsureCompletion() (or whatever it is) to make sure that the thread has finished In the PC class. How should I go about knowing weather or not the thread is done?

(comments are locked)
10|2000 characters needed characters left
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question