在linux POSIX库中关于线程创建接口:int pthread_create(pthread_t *thread, const pthread_attr_t *attr, void *(*start_routine) (void *), void *arg) 描述错误的是?
临时变量在线程创建时作为arg的传参是不安全的。
当线程的运行函数参数不止一个时,可以将参数放入结构体中,将结构体地址作为arg传参。
当const pthread_attr_t *attr参数为NULL时,具有和父进程同等的优先级。
pthread_t *thread返回的线程标识ID在 linux整个系统中具有唯一性。
pthread_t是一个线程标识符的数据类型,在Linux中,它通常是一个unsigned long类型的整数。pthread_create函数中的thread参数用于存储新创建线程的标识符。然而,pthread_t并不保证在整个系统中具有唯一性,它只是在当前进程中唯一标识一个线程。
B. 当线程的运行函数参数不止一个时,可以将参数放入结构体中,将结构体地址作为arg传参。当线程的运行函数需要多个参数时,可以将这些参数放入一个结构体中,然后将结构体的地址作为arg参数传递给pthread_create函数。
C. 当const pthread_attr_t *attr参数为NULL时,具有和父进程同等的优先级。当pthread_create函数的attr参数为NULL时,新创建的线程将继承父线程的属性,包括优先级。