腾讯云
开发者社区
文档
建议反馈
控制台
登录/注册
首页
学习
活动
专区
圈层
工具
MCP广场
文章/答案/技术大牛
搜索
搜索
关闭
发布
文章
问答
(9999+)
视频
沙龙
1
回答
尽管
从
pthread_create
()
返回
成功
,
但未
创建
任何
线程
c
、
linux
、
pthreads
、
posix
我已经在HP-UX甚至SUSE上写了相当多的
线程
代码,而且运行得很好。但它在红帽上不起作用。PTHREAD_SCOPE_SYSTEM); return_value =
pthread_create
/thr_ex
返回
值== %0
线程
id == 5888 但是在/tmp下不会
创建
任何
文件。strace -f没
浏览 30
提问于2020-10-16
得票数 2
1
回答
线程
函数局部变量何时与Posix一起分配?
c
、
multithreading
、
posix
我知道这是一个非常具体的问题,对于高级程序员来说,这并不是很有趣,但我想知道
线程
函数的局部变量到底是什么时候分配的,换句话说,是在
pthread_create
(&thread, &function,是否可以说它们存在于内存中(考虑到调度器可能还没有执行
线程
)?我在clone代码中看到了
线程
函数的调用,但我认为这应该只发生在
创建
的
线程
中(当
pthread_create
终止时,调度器永远不会执行),而不是在
创建
者中。
浏览 0
提问于2018-01-04
得票数 1
1
回答
为什么新
创建
的
线程
不通过
pthread_create
()
返回
参数而通过pthread_self()获得tid
linux
、
thread-safety
、
pthreads
这是
从
“Unix环境中的高级编程”
创建
线程
的示例代码。至于
线程
创建
,err =
pthread_create
(&ntid, NULL, thr_fn, NULL);新
创建
的
线程
可以只使用ntid打印自己的threadID,而不是调用pthread_self*/} main(void) int err; err =
pthread_creat
浏览 3
提问于2016-07-01
得票数 0
回答已采纳
1
回答
pthread_create
将终止具有相同tid的前一个
线程
?
linux
、
multithreading
我发现在下面的代码中,每次接受新客户端时都会
创建
一个
线程
。在函数pthread_client()中没有退出日志。但是,似乎没有通过命令ps aux
创建
多
线程
。我的理解是,每次用相同的tid
创建
一个新
线程
时,具有相同tid的旧
线程
都会自动被杀死,对吗?谢谢!.); pthread_detach(tid
浏览 0
提问于2019-03-13
得票数 0
回答已采纳
2
回答
写回的
pthread_create
计时
c
、
pthreads
、
race-condition
在调用
pthread_create
(& id,NULL,&start_routine,arg)时,是否保证在start_routine开始运行之前将
线程
id写入id?手册页清楚地表明,在对
pthread_create
的调用
返回
之前,start_routine可能但不一定会开始执行,但是它们在
线程
id何时被写回传递的
线程
参数时保持沉默。我的具体情况是,我对
pthread_create
有一个包装器: int mk_thread(pthread_t *id)
浏览 0
提问于2011-06-14
得票数 0
回答已采纳
1
回答
为什么
pthread_create
会
返回
一个整数?
c
、
multithreading
、
pthreads
我见过使用
线程
对数组求和的代码。在这段代码中,
创建
了一个
线程
,并
返回
一个int数据类型:iret1 =
pthread_create
( &thread1, NULL, print_message_function, (void*) message1); 我知道<e
浏览 1
提问于2012-05-24
得票数 0
回答已采纳
1
回答
我的
线程
不是平行的,它们是串行的。如何使它们并行?
c
、
multithreading
、
pthreads
我在练习多
线程
。{ pthread_t tid02; void * status02;
浏览 3
提问于2015-06-28
得票数 4
回答已采纳
2
回答
pthread_create
启动
创建
的
线程
吗?
c
、
linux
、
multithreading
、
pthreads
、
posix
函数"**
pthread_create
**"是启动
线程
(开始执行其函数),还是只
创建
线程
并让它等待正确的时机启动?
浏览 3
提问于2014-04-14
得票数 6
回答已采纳
3
回答
在打印之前调用
线程
,而打印在
线程
之前执行。
c
、
linux
、
pthreads
、
posix
下面是我在上运行的简单
线程
练习的代码。我担心的是,教程说输出应该是:Thread 2
pthread_create
() for thread但我得到了
pthread_create
() for thread 2 returns: 0Thread2#include <
浏览 5
提问于2016-11-08
得票数 1
回答已采纳
1
回答
用C语言实现pthread_self()
c
、
pthreads
我知道它
返回
线程
ID,但这个ID是一个内存位置,因为它
返回
一个pthread_t,我不知道如何解释它。此外,我将如何检索
线程
的id,是否只
创建
一个新
线程
并
返回
它?
浏览 0
提问于2018-10-05
得票数 0
回答已采纳
2
回答
C-
pthread_create
标识符
c
、
multithreading
pthread_create
()的第一个参数是一个thread对象,用于标识新
创建
的
线程
。然而,我不确定我是否完全理解其中的隐含。 例如,我正在编写一个简单的聊天服务器,并计划使用
线程
。
线程
会一直来来去去,所以跟踪thread对象可能会很复杂。然而,我不认为我应该识别单独的
线程
。我可以一遍又一遍地对
pthread_create
()的第一个参数使用相同的thread对象吗,或者对此有其他的影响吗?
浏览 0
提问于2014-03-30
得票数 0
1
回答
为什么fprintf不能在
线程
中工作?
c
、
multithreading
、
io
、
pthreads
、
stdout
我正在用
pthread_create
创建
一个
线程
。fprintf(stdout, "text\n"); fflush(stdout); int main(int argc, char **arg
浏览 0
提问于2013-04-11
得票数 3
回答已采纳
1
回答
在保持互斥对象的同时调用
pthread_create
安全吗?
multithreading
、
pthreads
、
mutex
、
shared-state
在某个时候,我确定我需要
创建
一个新
线程
,从而调用
pthread_create
,同时仍然保持互斥锁。这算安全吗?假设我的共享状态是一个全局计数器,它跟踪
成功
创建
的p
线程
的数量,而另一个
线程
使用该计数器在屏幕上实时显示信息。此外,我不希望p
线程
的数量超过某个最大值(例如,10表示确定值)。假设计数器当前为9,如果我增加计数器,然后在调用
pthread_create
之前释放互斥,那么
pthread_create
可能会失败,
浏览 3
提问于2017-05-23
得票数 0
2
回答
pthread_create
()是如何工作的?
c++
、
c
、
pthreads
鉴于以下情况:
pthread_create
(&thread, NULL, function, NULL);
Pthread_create
(&
线程
,NULL,another_function
浏览 3
提问于2012-05-03
得票数 11
回答已采纳
1
回答
调用
pthread_create
() c++ linux时出现段错误
c++
、
linux
、
segmentation-fault
、
pthreads
、
posix
here } if (
pthread_create
main.cpp{ return 0;代码编译得很好,但是当我运行它时,我在
pthread_create
浏览 0
提问于2017-05-29
得票数 0
1
回答
使用p
线程
来完成for循环中的工作
c
、
pthreads
目前,我已经为我的程序设计了一个单
线程
,我想将它移动到一个多
线程
设计中(OpenMP可能要容易得多,但不幸的是,这对于这个任务来说是不可接受的)。下面是我在for循环中使用
pthread_create
调用来
创建
4个
线程
的代码示例。在完成
pthread_create
循环之后,我需要随后运行一个for循环。如何使用多个
线程
运行for循环?我是否需要
创建
一个函数并将其传递给
pthread_create
,还是可以在之后立即使用for循环?
浏览 4
提问于2022-10-12
得票数 0
回答已采纳
2
回答
简单的
线程
进程:分割故障
c
、
pthreads
试图通过运行一个简单的程序来了解p
线程
是如何工作的,但是我在
pthread_create
上得到了分段错误(内核转储)#include <pthread.h> while (1) { } printf("helo\n"); if (
pthread_create
浏览 2
提问于2021-12-01
得票数 0
回答已采纳
1
回答
颤振:
从
Dart异步调用本地C代码(通过ffi)导致内存泄漏。
flutter
、
dart
、
crash
、
out-of-memory
它会以某种方式对抽头做出反应--因为我可以
从
我的一些小部件中看到我的调试打印。它对点击有反应,但不显示
任何
东西--屏幕是空的。当应用程序处于空屏幕显示状态时,调试控制台日志: libc ( 8725):
pthread_create
failed: couldn't mprotect R+W 1028096-byte thread我用Dart
创建
了Uint8列表,并将其传递给我的C代码。C代码将启动几个并行
线程
并
返回
到Dart。列表的长度等于
线程
数。然后
浏览 33
提问于2021-01-16
得票数 0
回答已采纳
2
回答
当p
线程
退出函数时,它会发生什么情况?
c
、
multithreading
、
pthreads
假设我在一个
pthread_create
(pthread_t *thread, pthread_attr_t *attr, void *(*fun) (void *), void *arg)循环中使用了while,那么当
线程
完成fun()函数时,它会发生什么变化?如果调用int pthread_detach(pthread_t thread),它也会落入主
线程
的循环中吗?或者主
线程
是否只停留在循环中?示例:while(1){ /
浏览 5
提问于2015-11-03
得票数 0
回答已采纳
1
回答
主
线程
在
pthread_create
()之后不会继续执行
c
、
pthreads
我已经使用
pthread_create
()
创建
了一个
线程
。新
线程
成功
创建
,并且控制传递给新
创建
的
线程
。但是,主
线程
似乎不再执行了。主
线程
处于无限循环中,永远不会退出。\n"); if((
pthread_create
(&newT
浏览 5
提问于2013-03-17
得票数 3
点击加载更多
热门
标签
更多标签
云服务器
对象存储
ICP备案
云点播
腾讯会议
活动推荐
运营活动
广告
关闭
领券