Android ndk 使用android工具链编译时未找到pthread_cancel

Android ndk 使用android工具链编译时未找到pthread_cancel,android-ndk,pthreads,cross-compiling,Android Ndk,Pthreads,Cross Compiling,我正在编译一个使用Android工具链配置的程序。我用的是ndk r10c。我使用 $./make-standalone-toolchain.sh --ndk-dir=/home/justin/bin/android-ndk-r10c/ --install-dir=/home/justin/android-toolchain/ 并且能够配置我的项目,但是当我make error: 'pthread_cancel' was not declared in this scope 标题有#incl

我正在编译一个使用Android工具链配置的程序。我用的是ndk r10c。我使用

$./make-standalone-toolchain.sh --ndk-dir=/home/justin/bin/android-ndk-r10c/ --install-dir=/home/justin/android-toolchain/
并且能够配置我的项目,但是当我
make

error: 'pthread_cancel' was not declared in this scope
标题有
#include
,似乎表明我应该能够像平常一样使用pthreads

我遗漏了什么吗?

仿生(Android的libc)没有
pthread\u cancel
。IIRC,当我们讨论添加它时,我们选择不添加它,因为它的实现容易出错并且对(所有代码的)性能有害


就我们所知,pthreads的任何实现都不会实现完全正确的
pthread\u cancel
。这也会给所有的代码带来成本,即使你没有使用
pthread\u cancel
(因为有太多的代码段需要被
pthread\u cancel
)来防止中断。

应该用什么来代替呢?这取决于很多情况。我们刚刚以同样的方式被发现,也就是说,使用名为pthread_cancel()的ndk将一个线程库移植到android。希望GIYF和我能够拼凑出android pthread头文件中的替代方案