Does Android support thread?

前端 未结 1 602
南方客
南方客 2021-01-19 14:40

Does Android support pthreads? And why when i use -pthread option i see the linker error:

i686-android-linux/bin/ld: cannot find -lpthread

#include         


        
1条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-19 14:58

    As far as I could see in the docs you do not need to use "-pthread". Checkout following:
    http://mobilepearls.com/labs/native-android-api/#pthreads

    Info from NDK offical docs states (android-ndk-r8\docs\system\libc\OVERVIEW.html):

    PThread implementation:
    Bionic's C library comes with its own pthread implementation bundled in. This is different from other historical C libraries which: - place it in an external library (-lpthread) - play linker tricks with weak symbols at dynamic link time

    So keep in mind that Bionic includes directly pthread as opposed to standard way you are used to (with -lpthread).

    0 讨论(0)
提交回复
热议问题