Germán Diago
Germán Diago

Reputation: 7673

c++11 thread or boost.thread support android ios

My question is very simple. I need to make use of threads on a game that will be running in android and iOS as the main platforms. I am using xcode 5 in Mac OSX 10.9 for development.

  1. Can I use c++11 threads?
  2. Can I use boost.thread, if c++11 threads are not ready?
  3. Otherwise, which are the alternatives?

Upvotes: 3

Views: 1216

Answers (2)

Halsafar
Halsafar

Reputation: 2640

Just did a test with XCode 5.1 IOS7.1.

  • Create new Empty project
  • Rename AppDelegate.m -> AppDelegate.mm
  • #include <thread>
  • Ran the following code:

std::thread t([]() { NSLog(@"thread function"); });

Worked.

Android

Same code runs in Android NDK r8e using GCC 4.7 (which is what I'm using atm). I updated to 9d and using GCC 4.8 it still works.

Upvotes: 4

hardsky
hardsky

Reputation: 514

I can only answer about android ndk.

  1. There is gcc 4.8 in lastest adnroid NDK. It seems promised, but I did not try it.

  2. You can. I used boost.thread at last project and it works perfect.

  3. posix threads

About IOS, I exactly know, that you can use boost. I worked with android project, that was port from IOS. There was a lot of boost in IOS version. And I think Xcode 5 must have good support of C++11, just write some test.

Upvotes: 2

Related Questions