Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
colorEagleStdio
taskbus
提交
59325796
taskbus
项目概览
colorEagleStdio
/
taskbus
通知
159
Star
11
Fork
3
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
taskbus
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
59325796
编写于
6月 24, 2023
作者:
M
manjaro-xfce
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
解决Linux下Qt6 的跨线程冲突
上级
c3485773
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
45 addition
and
14 deletion
+45
-14
taskbusplatform/core/tasknode.cpp
taskbusplatform/core/tasknode.cpp
+40
-12
taskbusplatform/core/tasknode.h
taskbusplatform/core/tasknode.h
+5
-2
未找到文件。
taskbusplatform/core/tasknode.cpp
浏览文件 @
59325796
...
...
@@ -39,8 +39,9 @@ taskNode::taskNode(QObject *parent)
connect
(
m_process
,
&
QProcess
::
bytesWritten
,
this
,
&
taskNode
::
slot_sended
);
connect
(
this
,
&
taskNode
::
private_sig_nextcab
,
this
,
&
taskNode
::
slot_readyReadStandardOutput
,
Qt
::
QueuedConnection
);
m_nBp_TimerID
=
startTimer
(
200
);
&
taskNode
::
slot_readyReadStandardOutput
,
Qt
::
QueuedConnection
);
connect
(
this
,
&
taskNode
::
sig_new_package
,
this
,
&
taskNode
::
slot_write
,
Qt
::
QueuedConnection
);
m_nBp_TimerID
=
startTimer
(
200
);
}
taskNode
::~
taskNode
()
{
...
...
@@ -356,19 +357,46 @@ void taskNode::slot_readyReadStandardError()
}
bool
taskNode
::
enqueue_write
(
QByteArray
arr
)
{
m_mtxPackage
.
lock
();
if
(
m_bDebug
)
log_package
(
false
,
arr
);
if
(
m_process
->
state
()
==
QProcess
::
Running
)
{
m_process
->
write
(
arr
);
++
m_spackage_recieved
;
m_sbytes_recieved
+=
arr
.
size
();
}
m_mtxPackage
.
unlock
();
#ifdef WIN32
m_mtxPackage
.
lock
();
if
(
m_bDebug
)
log_package
(
false
,
arr
);
if
(
m_process
->
state
()
==
QProcess
::
Running
)
{
m_process
->
write
(
arr
);
++
m_spackage_recieved
;
m_sbytes_recieved
+=
arr
.
size
();
}
m_mtxPackage
.
unlock
();
#else
m_mtxPackage
.
lock
();
int
z
=
m_queue
.
size
();
m_queue
.
push_back
(
arr
);
m_mtxPackage
.
unlock
();
if
(
!
z
)
emit
sig_new_package
();
#endif
return
true
;
}
void
taskNode
::
slot_write
()
{
m_mtxPackage
.
lock
();
QByteArrayList
arr_task
=
m_queue
;
m_queue
.
clear
();
m_mtxPackage
.
unlock
();
for
(
auto
p
=
arr_task
.
begin
();
p
!=
arr_task
.
end
();
++
p
)
{
if
(
m_bDebug
)
log_package
(
false
,
*
p
);
++
m_spackage_recieved
;
m_sbytes_recieved
+=
p
->
size
();
if
(
m_process
->
state
()
==
QProcess
::
Running
)
{
m_process
->
write
(
*
p
);
}
}
}
bool
taskNode
::
cmd_sendcmd
(
QMap
<
QString
,
QVariant
>
cmd
,
QSet
<
QString
>
destins
)
{
if
(
destins
.
contains
(
m_uuid
)
==
false
...
...
taskbusplatform/core/tasknode.h
浏览文件 @
59325796
...
...
@@ -24,7 +24,7 @@ class taskProject;
/*!
* \brief The taskNode class 管理一个构件进程的类
* 这个类包含基本的进程启动终止、管道维护
* A class that manages a component process. This class contains basic process
* A cla
push_back
ss that manages a component process. This class contains basic process
* start-up termination, pipeline maintenance
*/
class
taskNode
:
public
QObject
...
...
@@ -38,6 +38,7 @@ signals:
void
sig_pro_started
();
void
sig_pro_stopped
(
int
exitCode
,
QProcess
::
ExitStatus
exitStatus
);
void
sig_new_command
(
QMap
<
QString
,
QVariant
>
cmd
);
void
sig_new_package
();
void
sig_new_errmsg
(
QByteArrayList
);
void
sig_iostat
(
qint64
pid
,
quint64
pr
,
quint64
ps
,
quint64
br
,
quint64
bs
);
void
private_sig_nextcab
();
...
...
@@ -51,6 +52,7 @@ private slots:
void
slot_readyReadStandardOutput
();
void
slot_readyReadStandardError
();
void
slot_sended
(
qint64
);
void
slot_write
();
void
slot_started
(
);
void
slot_stopped
();
private:
...
...
@@ -69,7 +71,8 @@ private:
QFile
m_dbgfile_stdout
;
QFile
m_dbgfile_stderr
;
QString
m_uuid
;
QMutex
m_mtxPackage
;
QMutex
m_mtxPackage
;
QList
<
QByteArray
>
m_queue
;
QString
dbgdir
();
//Call these functions to emit message and packs with bufferring approach.
void
emit_message
(
QByteArray
a
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录