#include <classic_context.h>
|
| std::atomic< bool > | stop_ {false} |
| |
◆ ClassicContext() [1/2]
| apollo::cyber::scheduler::ClassicContext::ClassicContext |
( |
| ) |
|
◆ ClassicContext() [2/2]
| apollo::cyber::scheduler::ClassicContext::ClassicContext |
( |
const std::string & |
group_name | ) |
|
|
explicit |
◆ NextRoutine()
| std::shared_ptr< CRoutine > apollo::cyber::scheduler::ClassicContext::NextRoutine |
( |
| ) |
|
|
overridevirtual |
实现了 apollo::cyber::scheduler::ProcessorContext.
在文件 classic_context.cc 第 52 行定义.
52 {
54 return nullptr;
55 }
56
57 for (int i = MAX_PRIO - 1; i >= 0; --i) {
58 ReadLockGuard<AtomicRWLock> lk(lq_->at(i));
59 for (auto& cr : multi_pri_rq_->at(i)) {
60 if (!cr->Acquire()) {
61 continue;
62 }
63
64 if (cr->UpdateState() == RoutineState::READY) {
65 return cr;
66 }
67
68 cr->Release();
69 }
70 }
71
72 return nullptr;
73}
std::atomic< bool > stop_
#define cyber_unlikely(x)
◆ Notify()
| void apollo::cyber::scheduler::ClassicContext::Notify |
( |
const std::string & |
group_name | ) |
|
|
static |
在文件 classic_context.cc 第 92 行定义.
92 {
93 (&
mtx_wq_[group_name])->Mutex().lock();
95 (&
mtx_wq_[group_name])->Mutex().unlock();
96 cv_wq_[group_name].Cv().notify_one();
97}
static GRP_WQ_MUTEX mtx_wq_
static NOTIFY_GRP notify_grp_
◆ RemoveCRoutine()
| bool apollo::cyber::scheduler::ClassicContext::RemoveCRoutine |
( |
const std::shared_ptr< CRoutine > & |
cr | ) |
|
|
static |
在文件 classic_context.cc 第 99 行定义.
99 {
100 auto grp = cr->group_name();
101 auto prio = cr->priority();
102 auto crid = cr->id();
105 for (auto it = croutines.begin(); it != croutines.end(); ++it) {
106 if ((*it)->id() == crid) {
107 auto cr = *it;
108 cr->Stop();
109 while (!cr->Acquire()) {
110 std::this_thread::sleep_for(std::chrono::microseconds(1));
111 AINFO_EVERY(1000) <<
"waiting for task " << cr->name() <<
" completion";
112 }
113 croutines.erase(it);
114 cr->Release();
115 return true;
116 }
117 }
118 return false;
119}
static RQ_LOCK_GROUP rq_locks_
static CR_GROUP cr_group_
#define AINFO_EVERY(freq)
◆ Shutdown()
| void apollo::cyber::scheduler::ClassicContext::Shutdown |
( |
| ) |
|
|
overridevirtual |
◆ Wait()
| void apollo::cyber::scheduler::ClassicContext::Wait |
( |
| ) |
|
|
overridevirtual |
◆ cr_group_
| CR_GROUP apollo::cyber::scheduler::ClassicContext::cr_group_ |
|
static |
◆ cv_wq_
| GRP_WQ_CV apollo::cyber::scheduler::ClassicContext::cv_wq_ |
|
static |
◆ mtx_wq_
| GRP_WQ_MUTEX apollo::cyber::scheduler::ClassicContext::mtx_wq_ |
|
static |
◆ notify_grp_
| NOTIFY_GRP apollo::cyber::scheduler::ClassicContext::notify_grp_ |
|
static |
◆ rq_locks_
| RQ_LOCK_GROUP apollo::cyber::scheduler::ClassicContext::rq_locks_ |
|
static |
该类的文档由以下文件生成: