Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Pinoxchio
apollo
提交
841a2529
A
apollo
项目概览
Pinoxchio
/
apollo
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
A
apollo
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
841a2529
编写于
11月 14, 2018
作者:
G
gruminions
提交者:
Jiangtao Hu
12月 13, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
framework: code clean
上级
c568fefb
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
5 addition
and
17 deletion
+5
-17
cyber/croutine/croutine.cc
cyber/croutine/croutine.cc
+3
-2
cyber/croutine/croutine.h
cyber/croutine/croutine.h
+2
-11
cyber/croutine/routine_factory.h
cyber/croutine/routine_factory.h
+0
-4
未找到文件。
cyber/croutine/croutine.cc
浏览文件 @
841a2529
...
...
@@ -19,6 +19,7 @@
#include <utility>
#include "cyber/base/concurrent_object_pool.h"
#include "cyber/common/global_data.h"
#include "cyber/common/log.h"
#include "cyber/croutine/routine_context.h"
#include "cyber/event/perf_event_cache.h"
...
...
@@ -41,12 +42,12 @@ void CRoutineEntry(void *arg) {
r
->
Run
();
CRoutine
::
Yield
(
RoutineState
::
FINISHED
);
}
}
}
// namespace
CRoutine
::
CRoutine
(
const
std
::
function
<
void
()
>
&
func
)
:
func_
(
func
)
{
if
(
unlikely
(
context_pool
==
nullptr
))
{
auto
routine_num
=
100
;
auto
global_conf
=
common
::
GlobalData
::
Instance
()
->
Config
();
auto
&
global_conf
=
common
::
GlobalData
::
Instance
()
->
Config
();
if
(
global_conf
.
has_scheduler_conf
()
&&
global_conf
.
scheduler_conf
().
has_routine_num
())
{
routine_num
=
global_conf
.
scheduler_conf
().
routine_num
();
...
...
cyber/croutine/croutine.h
浏览文件 @
841a2529
...
...
@@ -76,7 +76,7 @@ class CRoutine {
void
set_id
(
uint64_t
id
);
const
std
::
string
&
name
()
const
;
void
set_name
(
std
::
string
name
);
void
set_name
(
const
std
::
string
&
name
);
int
processor_id
()
const
;
void
set_processor_id
(
int
processor_id
);
...
...
@@ -84,9 +84,6 @@ class CRoutine {
uint32_t
priority
()
const
;
void
set_priority
(
uint32_t
priority
);
double
proc_num
()
const
;
void
set_proc_num
(
double
num
);
private:
CRoutine
(
CRoutine
&
)
=
delete
;
CRoutine
&
operator
=
(
CRoutine
&
)
=
delete
;
...
...
@@ -103,7 +100,6 @@ class CRoutine {
std
::
atomic_flag
updated_
=
ATOMIC_FLAG_INIT
;
bool
force_stop_
=
false
;
double
proc_num_
=
0.0
;
int
processor_id_
=
-
1
;
uint32_t
priority_
=
1
;
...
...
@@ -135,7 +131,6 @@ inline void CRoutine::SetMainContext(
}
inline
RoutineContext
*
CRoutine
::
GetContext
()
{
return
context_
.
get
();
}
RoutineState
Resume
();
inline
void
CRoutine
::
Run
()
{
func_
();
}
...
...
@@ -158,7 +153,7 @@ inline void CRoutine::set_id(uint64_t id) { id_ = id; }
inline
const
std
::
string
&
CRoutine
::
name
()
const
{
return
name_
;
}
inline
void
CRoutine
::
set_name
(
std
::
string
name
)
{
name_
=
name
;
}
inline
void
CRoutine
::
set_name
(
const
std
::
string
&
name
)
{
name_
=
name
;
}
inline
int
CRoutine
::
processor_id
()
const
{
return
processor_id_
;
}
...
...
@@ -187,10 +182,6 @@ inline uint32_t CRoutine::priority() const { return priority_; }
inline
void
CRoutine
::
set_priority
(
uint32_t
priority
)
{
priority_
=
priority
;
}
inline
double
CRoutine
::
proc_num
()
const
{
return
proc_num_
;
}
inline
void
CRoutine
::
set_proc_num
(
double
num
)
{
proc_num_
=
num
;
}
inline
bool
CRoutine
::
Acquire
()
{
return
!
lock_
.
test_and_set
(
std
::
memory_order_acquire
);
}
...
...
cyber/croutine/routine_factory.h
浏览文件 @
841a2529
...
...
@@ -30,10 +30,6 @@ namespace apollo {
namespace
cyber
{
namespace
croutine
{
using
common
::
GlobalData
;
using
apollo
::
cyber
::
event
::
PerfEventCache
;
using
apollo
::
cyber
::
event
::
SchedPerf
;
class
RoutineFactory
{
public:
using
VoidFunc
=
std
::
function
<
void
()
>
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录