找不到pthread_cancel用android工具链编译

JuJ*_*oDi 2 pthreads cross-compiling android-ndk

我正在编译一个使用Android工具链配​​置的程序.我正在使用ndk r10c.我使用了一个独立的工具链

$./make-standalone-toolchain.sh --ndk-dir=/home/justin/bin/android-ndk-r10c/ --install-dir=/home/justin/android-toolchain/
Run Code Online (Sandbox Code Playgroud)

并能够配置我的项目,但是当make我得到

error: 'pthread_cancel' was not declared in this scope
Run Code Online (Sandbox Code Playgroud)

标题有#include <pthread.h>,这个答案似乎表明我应该像往常一样使用pthreads.

我错过了什么吗?

Dan*_*ert 5

Bionic(Android的libc)没有pthread_cancel.IIRC,当我们讨论添加这个时,我们选择不这样做,因为它的实现容易出错并且对性能有害(所有代码).

据我们所知,pthreads的实现没有实现完全正确pthread_cancel.它也会对所有代码施加成本,即使你没有使用pthread_cancel(因为需要保护许多代码段不受中断pthread_cancel).