腾讯云
开发者社区
文档
建议反馈
控制台
登录/注册
首页
学习
活动
专区
圈层
工具
MCP广场
文章/答案/技术大牛
搜索
搜索
关闭
发布
文章
问答
(9999+)
视频
沙龙
2
回答
在C中使用线程时的奇怪行为
、
、
假设我使用
命令行
输入10,则期望输出为20,因为有两个线程将计数的值递增10倍。然而,输出不是每次我运行这个程序20。以下是我的一些尝试:
命令行
输入: 10,预期输出: 20,实际输出: 10
命令行
输入:10,例外输出: 20,实际输出: 20#include <
pthread
.h> /* The
浏览 6
提问于2015-03-23
得票数 0
回答已采纳
1
回答
OpenMp到Pthreads文件
、
、
要知道
pthread
对openmp指令的调用,需要使用哪些gcc
命令行
语句?我知道在汇编,简单,rtl,树中生成IR文件的-fdump
命令行
语句。但是我无法为openmp指令获取任何
pthread
转储。
浏览 1
提问于2014-10-20
得票数 0
1
回答
gcc 4.8.2在Linux上使用线程崩溃的简单程序
、
、
、
、
我刚刚在Centos上安装了gcc 4.8.2 (我正在使用devtoolset-2)。我用线程编写了一个非常简单的程序。它编译得很好,但在执行时会崩溃? #include <iostream> { } { t.join(); } scl enable devtoo
浏览 4
提问于2014-06-29
得票数 3
回答已采纳
2
回答
如果有std::线程,则VisualStudio2017 linux无法编译
、
、
、
、
`std::thread::thread<void(&)(int), int&>(void(&)(int), int&)': 链接器->附加选项->添加-
pthread
-lpthread或只添加-
pt
浏览 0
提问于2018-10-31
得票数 4
回答已采纳
1
回答
如何从cython安装文件中删除-
pthread
编译器标志
、
、
、
在linux环境中,当我为cython运行安装脚本时,我得到 gcc -
pthread
-B /apps/...
浏览 3
提问于2019-07-15
得票数 4
回答已采纳
1
回答
错误: /tmp/ccOB6cIT.o: In函数‘`main':example.c:(.text+0x4a)
、
、
我从一个实践文件中获得了以下代码#include <
pthread
.h>{}{
pthread
_create (&kid,NULL, kidfunc, NULL) ; printf ("Parent
浏览 0
提问于2017-04-09
得票数 1
回答已采纳
1
回答
如何修复xampp apache在Windows7上复制php_pthreads.dll后无法运行
、
如何修复我的apache后,复制文件php_pthreads.dll激活phpthread在php7.2.9,但
pthread
正在运行,此错误 5:06:34 PM [Apache] Error: Apache
浏览 0
提问于2018-09-21
得票数 0
1
回答
传递std::通过直接函数调用向函数承诺对象
、
我正在学习std::promise和std::future在C++。我写了一个简单的程序来计算两个数字的乘法。{} { int b = 10; std::future<int> prodResult = prodPromise.get_f
浏览 6
提问于2020-06-10
得票数 3
回答已采纳
2
回答
连接多个线程后打印多个子线程的返回值
、
、
我的程序本质上应该做的是,它接受多个
命令行
参数,并为每个参数创建一个线程。每个线程都分配给一个primefactors函数,该函数返回指向原始因素值的指针。= malloc(count * sizeof(
pthread
_t));
pthread
_attr_init(&attr);p[n]); } }
浏览 1
提问于2016-10-06
得票数 0
回答已采纳
2
回答
任意数量的线程
、
、
、
、
#include <stdio.h>#include <stdlib.h>
pthread
_t tid = gettid(); // create the thread
浏览 3
提问于2019-11-13
得票数 2
回答已采纳
1
回答
为什么当我在同一线程中两次使用
pthread
_mutex_lock时,没有发生核心转储?
、
#include <
pthread
.h>{
pthread
_mutex_init(&mtx, NULL);
pthread
_mutex_lock(&mtx);} 我在CentOS7中运行这段代码,我希望有一个核心转储文件,但它没有,程序只是
浏览 0
提问于2021-03-02
得票数 0
1
回答
检查
命令行
参数是否是使用线程的回文字
、
、
对于
命令行
中的每个单词,它创建一个线程,该线程检查单词是否为回文。如果单词是回文,它会增加一个全局变量(在线程中)。#include <stdlib.h>#include <unistd.h> #include <
pthread
.h>int var_global = 0;
浏览 3
提问于2015-06-04
得票数 0
1
回答
Makefile不包括库
、
我正在尝试编译一些东西,并将
pthread
库包含在我的makefile中,但它似乎没有将其放在
命令行
中。如果我直接在
命令行
中输入它,它就会编译,但是如果我尝试使用我的makefile,它就会出现未定义的引用
pthread
_join之类的错误。
浏览 1
提问于2014-08-15
得票数 1
1
回答
g++编译器:错误无效的转换从'
pthread
_t {aka长无符号int}‘到'void* (*)(void*)’[-fpermissive]
、
、
我试图在
命令行
上编译我的程序,我得到了这个错误。它指向下面代码中的
pthread
_create行。我有正确的线程导入,我在Ubuntu上运行,所以我知道这不是问题。否则,我对发生的事情一无所知。int main() { if(
pthread
_create(&thinker, NULL, thinker, NULL)) {perror("ERROR creating thread.");
pthread
_j
浏览 1
提问于2015-09-27
得票数 0
回答已采纳
2
回答
连接到外部库的g++创建未定义的引用
、
、
/lib/libwdt_dio.so: undefined reference to `
pthread
_mutexattr_settype'/usr/lib/gcc/x86_64-linux-gnu/5/.
浏览 4
提问于2017-10-03
得票数 0
回答已采纳
1
回答
我如何知道
pthread
_mutex_destroy中的sys错误是什么?
、
、
我使用的是命令'
pthread
_mutex_destroy(&lock);‘。在此命令的手册页中,据说失败时返回一个非零值,但没有指定的方法来检查它。
浏览 1
提问于2011-04-04
得票数 0
1
回答
GCC在Debian #include thrd_create()之后,在C11模式下对<threads.h> ()的未定义引用
、
、
、
我正在尝试编译一个程序,我已经能够在其他几个Debian环境上编译,没有任何问题,使用C11 <threads.h>库对安装了"gcc (Debian 10.2.1-6) 10.2.1 20210110“的较新的Debian进行安装。gcc -o <progname> -O3 -Wall -Wextra -std=c11 -lpthread <sourcefile> 我得到了一系列链接器错误,比如undefined reference to 'mtx_unlock',以及mtx_lock,mtx_init,thrd_crea
浏览 10
提问于2022-04-18
得票数 0
回答已采纳
2
回答
pthread
库未定义引用
我在Fedora17(和GCC)上使用eclipse,并且我在
pthread
_create ()上有一个未定义的引用,即使包含
pthread
.h,如果我在gcc的构建
命令行
上有-lpthread ...= 2 ) printf( "PAIR : %d\n", var );} // pair {
pthread
_create(&
浏览 2
提问于2013-02-27
得票数 6
回答已采纳
1
回答
未定义的引用
pthread
_create
、
each thread
pthread
_t t1; res1 =
pthread
_create(&t1, NULL, do_that, (' Undefined reference to '
浏览 7
提问于2017-03-02
得票数 0
1
回答
在试图运行C线程程序的
命令行
中获得拒绝权限的错误
、
、
、
、
我试图让一个程序在
命令行
中运行,并给出两个数字,一个用于线程#,一个用于整数测试,以显示该int的和积和积。但是,当我编译并运行它时,
命令行
表示拒绝权限。即使我改变了所有的权限来读,写和前。#include <stdio.h>#include <
pthread
.h> void *getSum(void *param); void* tid = (
pthread
_t*)calloc(threads + 1, sizeof(
浏览 2
提问于2014-01-26
得票数 0
回答已采纳
点击加载更多
相关
资讯
命令行工具
Android ADB 命令行
linux系统命令行
3.2 Linux 命令行
vlc命令行用法
热门
标签
更多标签
云服务器
ICP备案
腾讯会议
云直播
对象存储
活动推荐
运营活动
广告
关闭
领券