pthreads - as400/IBM i 上的 pthread 错误代码 3025 (ENOENT)?
问题描述
当我有以下在 IBM i Midrange 上运行的 C 源代码时,我得到一个非零结果pthread_create
,特别是 3025,它是 ENOENT(没有这样的路径或目录),这没有任何意义我。任何人都对错误在这种情况下 的实际含义有任何想法。
#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
. http://pubs.opengroup.org/onlinepubs/7908799/xsh/pthread_create.htmlrc
char *msg = strerror(rc);
推荐阅读
- ruby-on-rails - 脚手架再生后无法启动 rails s
- javascript - Communicate with web explorer
- wso2 - 在 WS02 上,速率限制成功,但配额没有
- c# - Unity:碰撞器不通过脚本调整 Sprite Shape 的大小
- python - 如何修复'ctypes.ArgumentError:参数1:
:预期 LP_c_ulong 实例而不是 LP_SECURITY_ATTRIBUTES' - wavesplatform - 如何在 Wave 平台上创建自定义网关和自定义 Wave 钱包
- javascript - 从 Nodejs Module.Exports 接收数据
- c# - 从数据库中读取 lambda 并执行它
- vb.net - 将变量传递给未打开的表单
- react-native - 在 websocket 重新连接事件上反应本机错误