1

I am facing a dilemma here. I have been working for over a year on a Computer Vision project which includes BOOST threads under windows/vs2010. Suddenly there is a requirement to move the code towards Android. Now after reading through on the internet, it seems that I have two choices

  1. Somehow build the BOOST thread libraries under JNI which is like a nightmare to me
  2. Remove BOOST threads and replace them with pthreads, windows threads, etc.

But If I remove BOOST, will replacing them with pthreads be useful? Will the code after wrapping in JNI work under android?

Any guidelines is helpful.

Thanks

Wajih
  • 793
  • 3
  • 14
  • 31
  • 1
    pthreads will definitely work on android (but yea, i know, that's only half of the decision) – berak Mar 17 '14 at 08:02
  • Thanks! Well if pthreads work, this means I can port rest of the code as OpenCV seems to be supported on android. – Wajih Mar 17 '14 at 08:12
  • 1
    Building `Boost.Thread` with Android NDK is very simple. Besides, Android NDK uses c++11-enabled toolchains, so you can just move to `std::thread`. – Igor R. Mar 17 '14 at 09:42
  • Well I am using android-ndk-r9d-windows on 64Bit windows 7. So I assume the NDK does use std::thread? And I am not sure what you mean by building BOOST on android NDK is simple. – Wajih Mar 17 '14 at 09:58
  • 1
    NDK r9d contains gcc4.8 and clang3.4 toolchans, the both support c++11 and have the appropriate standard library (including `std::thread`). As for building Boost with NDK, [see this answer](http://stackoverflow.com/questions/17667978/using-boost-in-android-ndk-with-windows). Using `boost::thread` will keep your code portable (compilable with MSVC10 or pre-c++11 gcc). – Igor R. Mar 17 '14 at 14:23
  • Thanks for the link. I will go through it! – Wajih Mar 17 '14 at 14:27

0 Answers0