MCPcopy Create free account
hub / github.com/acl-dev/acl / del_task

Method del_task

lib_acl_cpp/src/stream/aio_timer_callback.cpp:86–112  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

84#define TIMER_EMPTY -1
85
86acl_int64 aio_timer_callback::del_task(unsigned int id)
87{
88 bool ok = false;
89 std::list<aio_timer_task*>::iterator it = tasks_.begin();
90 for (; it != tasks_.end(); ++it) {
91 if ((*it)->id == id) {
92 delete (*it);
93 tasks_.erase(it);
94 length_--;
95 ok = true;
96 break;
97 }
98 }
99
100 if (!ok) {
101 logger_warn("timer id: %u not found", id);
102 }
103
104 if (tasks_.empty()) {
105 return TIMER_EMPTY;
106 }
107
108 set_time();
109
110 acl_int64 delay = tasks_.front()->when - present_;
111 return delay < 0 ? 0 : delay;
112}
113
114acl_int64 aio_timer_callback::set_task(unsigned int id, acl_int64 delay)
115{

Callers 1

del_timerMethod · 0.45

Calls 3

beginMethod · 0.80
endMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected