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"

How do I execute code on the Game thread from an FRunnable thread?

Hello, I have an FRunnable thread that is checking if data has been received on a few FSockets. Whenever specific data arrives from the sockets, I want to execute code on the game thread.

How can I execute code on the game thread from the FRunnable thread?

Thanks

Product Version: UE 4.8
Tags:
more ▼

asked Jul 23 '15 at 05:36 PM in C++ Programming

avatar image

jgcoded
21 4 8 10

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

Easiest way is to create your own queue of things to run on the game thread. Then poll that queue to execute the task when present. You can see an example in the Steam OSS

more ▼

answered Jul 23 '15 at 07:08 PM

avatar image

joeGraf STAFF
1.5k 35 12 69

avatar image jgcoded Jul 23 '15 at 07:30 PM

Ok that's pretty easy. Is there any way to schedule something on the task graph from within my FRunnable such that I don't have to poll the queue? I would like everything to be as automated as possible

avatar image joeGraf STAFF Jul 23 '15 at 08:30 PM

You can't safely access game thread data from another thread whether it's a monolithic or task graph thread

avatar image jgcoded Jul 23 '15 at 10:35 PM

Ok thanks for your answers

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
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