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"

Are there any cross-platform implementations of synchronization primitives in C++?

All I've been able to find are FSemaphores defined in FGenericPlatformProcess and it seems like there's only a platform implementation for Windows. I'm hoping to find some implementations of mutexes and semaphores that at least exist for Mac/PC/Linux and Android.


Product Version: Not Selected
more ▼

asked Mar 18 '15 at 03:01 AM in C++ Programming

avatar image

13 1 1 4

avatar image MJ_01 Aug 08 '15 at 05:25 PM

Bumb. Yeah. It's kinda frustrating that a multi platform engine would implement something like this for only a single platform.

avatar image Shadowriver Aug 08 '15 at 06:26 PM

Hmm maybe post feature request on feedback forum, or if you up to it write implementations to other platfroms and submit pull request

avatar image MJ_01 Aug 08 '15 at 08:06 PM

Oh if I only knew how they worked on other platforms. I guess I'll have to learn someday.

avatar image Shadowriver Aug 08 '15 at 08:16 PM

Well without common implementation in UE4 you are forced to learn and use platfrom specific either way

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

1 answer: sort voted first

There actually is, it's called FEvent and represents a simple signaling primitive. It's used for example to ensure the game thread waits for the render thread.

There are other primitives such as FScopedEvent or FThreadSafeCounter, have a look into ThreadingBase.h.

You have even FPlatformMisc::MemoryBarrier(); supported in every platform.

more ▼

answered Aug 08 '15 at 08:53 PM

avatar image

6.4k 127 98 606

avatar image ColdSteel48 Apr 16 '17 at 10:20 PM

In case that someone needs an example on how to use FEvent I made a short Wiki with example: MultiThreading and synchronization Guide

(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