| 112 | } |
| 113 | |
| 114 | acl_int64 aio_timer_callback::set_task(unsigned int id, acl_int64 delay) |
| 115 | { |
| 116 | aio_timer_task* task = NULL; |
| 117 | std::list<aio_timer_task*>::iterator it = tasks_.begin(); |
| 118 | for (; it != tasks_.end(); ++it) { |
| 119 | if ((*it)->id == id) { |
| 120 | task = (*it); |
| 121 | tasks_.erase(it); |
| 122 | length_--; |
| 123 | break; |
| 124 | } |
| 125 | } |
| 126 | |
| 127 | if (task == NULL) { |
| 128 | task = NEW aio_timer_task(); |
| 129 | task->delay = delay; |
| 130 | task->id = id; |
| 131 | } else { |
| 132 | task->delay = delay; |
| 133 | } |
| 134 | |
| 135 | return set_task(task); |
| 136 | } |
| 137 | |
| 138 | acl_int64 aio_timer_callback::set_task(aio_timer_task* task) |
| 139 | { |