as400/IBM i 上的 pthread 错误代码 3025 (ENOENT)?
pthread error code 3025 (ENOENT) on the as400/IBM i?
当我在 IBM i Midrange 上有以下 C 源代码时,它是 运行,然后我从 pthread_create
得到一个非零结果,特别是 3025,它是 ENOENT(否这样的路径或目录),这对我来说没有任何意义。任何人都对错误 actually 在这种情况下的含义有任何想法。
#define _MULTI_THREADED
#define _XOPEN_SOURCE 520
#include <pthread.h>
#include <stdio.h>
#include <errno.h>
void* workerThread(void* parm) {
// Do some work here
pthread_exit(NULL);
}
int main(int argc, char* argv[]) {
pthread_t t;
int rc;
rc = pthread_create(&t, NULL, workerThread, NULL);
if (rc != 0) {
char *msg = strerror(errno);
perror("pthread_create failed");
}
// Other code here
return 0;
}
pthread_create
没有设置 errno
。您应该检查 strerror
个 rc
。
http://pubs.opengroup.org/onlinepubs/7908799/xsh/pthread_create.html
char *msg = strerror(rc);
当我在 IBM i Midrange 上有以下 C 源代码时,它是 运行,然后我从 pthread_create
得到一个非零结果,特别是 3025,它是 ENOENT(否这样的路径或目录),这对我来说没有任何意义。任何人都对错误 actually 在这种情况下的含义有任何想法。
#define _MULTI_THREADED
#define _XOPEN_SOURCE 520
#include <pthread.h>
#include <stdio.h>
#include <errno.h>
void* workerThread(void* parm) {
// Do some work here
pthread_exit(NULL);
}
int main(int argc, char* argv[]) {
pthread_t t;
int rc;
rc = pthread_create(&t, NULL, workerThread, NULL);
if (rc != 0) {
char *msg = strerror(errno);
perror("pthread_create failed");
}
// Other code here
return 0;
}
pthread_create
没有设置 errno
。您应该检查 strerror
个 rc
。
http://pubs.opengroup.org/onlinepubs/7908799/xsh/pthread_create.html
char *msg = strerror(rc);