pthread_create 使用 0 作为属性参数
pthread_create uses 0 as attribute parameter
我目前正在调试遗留代码,此代码在 Linux 环境中使用 pthread_create()。
它没有使用 NULL 或 attr,而是使用 0 作为第二个参数。我已经阅读了主页:http://man7.org/linux/man-pages/man3/pthread_attr_init.3.html,它没有提到使用 0 或整数作为属性参数。
实际代码如下:
pthread_t hndThread_IPv4;
int pthread_create_ret = pthread_create(&hndThread_IPv4, 0, PushPackageToClient, pStatusTable);
pthread_detach(hndThread_IPv4);
我的问题是 0 属性的这种用法是否会影响线程?
此线程在调用 SQLFreeHandle() 关闭 DBStatement 时偶尔会出现 crashing/disappearing 问题。
在C中,指针上下文中的0
是一个空指针常量,所以这只是将NULL
作为第二个参数传递,意味着线程是使用默认属性创建的。
我目前正在调试遗留代码,此代码在 Linux 环境中使用 pthread_create()。
它没有使用 NULL 或 attr,而是使用 0 作为第二个参数。我已经阅读了主页:http://man7.org/linux/man-pages/man3/pthread_attr_init.3.html,它没有提到使用 0 或整数作为属性参数。
实际代码如下:
pthread_t hndThread_IPv4;
int pthread_create_ret = pthread_create(&hndThread_IPv4, 0, PushPackageToClient, pStatusTable);
pthread_detach(hndThread_IPv4);
我的问题是 0 属性的这种用法是否会影响线程?
此线程在调用 SQLFreeHandle() 关闭 DBStatement 时偶尔会出现 crashing/disappearing 问题。
在C中,指针上下文中的0
是一个空指针常量,所以这只是将NULL
作为第二个参数传递,意味着线程是使用默认属性创建的。