pthread_kill_other_threads_np函数用法详解
pthread_kill_other_threads_np函数简介
- 头文件包含
#include <pthread.h>
- 函数定义
void pthread_kill_other_threads_np(void);
pthread_kill_other_threads_np函数常见使用错误
- 编译错误
warning: implicit declaration of function ‘pthread_kill_other_threads_np’ [-Wimplicit-function-declaration]
解决办法:包含头文件
#include <pthread.h>
pthread_kill_other_threads_np函数详细描述
pthread_kill_other_threads_np ()仅在LinuxThreads线程实现中有作用。在该实现中,调用此函数会立即终止应用程序中的所有线程,但调用线程除外。将忽略将要终止的线程的取消状态和取消类型,并且不在这些线程中调用清理处理程序。
pthread_kill_other_threads_np函数其他说明
pthread_kill_other_threads_np ()是要在线程调用execve (2)或类似函数之前调用的。该函数旨在解决过时的LinuxThreads实现中的一个限制,即应用程序的其他线程在execve (2)期间不会自动终止(如POSIX.1-2001所要求的)
在NPTL线程实现中,pthread_kill_other_threads_np ()存在,但不执行任何操作。(不需要做任何事情,因为实现在execve (2))期间做了正确的事情。)
评论区