forked from ChunelFeng/CGraph
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGEvent.cpp
More file actions
33 lines (27 loc) · 785 Bytes
/
GEvent.cpp
File metadata and controls
33 lines (27 loc) · 785 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/***************************
@Author: Chunel
@Contact: chunel@foxmail.com
@File: GEvent.cpp
@Time: 2023/1/20 23:07
@Desc:
***************************/
#include "GEvent.h"
CGRAPH_NAMESPACE_BEGIN
CStatus GEvent::process(GEventType type) {
CGRAPH_FUNCTION_BEGIN
switch (type) {
case GEventType::SYNC: // 同步触发
this->trigger(this->param_);
break;
case GEventType::ASYNC: // 异步触发
CGRAPH_ASSERT_NOT_NULL(this->thread_pool_)
thread_pool_->commit([this] {
this->trigger(this->param_);
}, CGRAPH_POOL_TASK_STRATEGY);
break;
default:
CGRAPH_RETURN_ERROR_STATUS("unknown event type")
}
CGRAPH_FUNCTION_END
}
CGRAPH_NAMESPACE_END