This commit is contained in:
azw 2023-04-09 08:03:10 +00:00
parent fe7fe5c62e
commit 925f11416a

View File

@ -122,40 +122,34 @@ bool App::Init(int argc, char* argv[])
if (getenv("is_dev_env")) { if (getenv("is_dev_env")) {
perf_log_time = 1000 * 10; perf_log_time = 1000 * 10;
} }
#if 0 f8::Timer::Instance()->SetInterval
f8::Timer::Instance()->AddRepeatTimer(perf_log_time, (perf_log_time,
a8::XParams(), [] (int event, const a8::Args* args)
[] (const a8::XParams& param)
{ {
SavePerfLog(); SavePerfLog();
}); });
#endif
} }
if (HasFlag(1)) { if (HasFlag(1)) {
#if 0 f8::Timer::Instance()->SetTimeout
f8::Timer::Instance()->AddDeadLineTimer( (
1000 * 60, 1000 * 60,
a8::XParams(), [] (int event, const a8::Args* args)
[] (const a8::XParams& param)
{ {
App::Instance()->terminated = true; App::Instance()->terminated = true;
App::Instance()->NotifyLoopCond(); App::Instance()->NotifyLoopCond();
} }
); );
#endif
} }
if (HasFlag(4)) { if (HasFlag(4)) {
#if 0 f8::Timer::Instance()->SetTimeout
a8::Timer::Instance()->AddDeadLineTimer( (
1000 * 30, 1000 * 30,
a8::XParams(), [] (int event, const a8::Args* args)
[] (const a8::XParams& param)
{ {
App::Instance()->shutdowned = true; App::Instance()->shutdowned = true;
a8::XPrintf("shutdowned\n", {}); a8::XPrintf("shutdowned\n", {});
} }
); );
#endif
} }
return true; return true;
} }
@ -253,7 +247,10 @@ void App::Schedule()
{ {
std::unique_lock<std::mutex> lk(*loop_mutex_); std::unique_lock<std::mutex> lk(*loop_mutex_);
if (!HasTask()) { if (!HasTask()) {
#if 0 #if 1
int sleep_time = 1;
loop_cond_->wait_for(lk, std::chrono::milliseconds(sleep_time));
#else
int sleep_time = f8::Timer::Instance()->GetIdleableMillSeconds(); int sleep_time = f8::Timer::Instance()->GetIdleableMillSeconds();
loop_cond_->wait_for(lk, std::chrono::milliseconds(sleep_time)); loop_cond_->wait_for(lk, std::chrono::milliseconds(sleep_time));
if (sleep_time > perf.max_timer_idle) { if (sleep_time > perf.max_timer_idle) {