@override
| 263 | private: |
| 264 | // @override |
| 265 | void* run() { |
| 266 | while (!stop_) { |
| 267 | T* o = mbox_.pop(delay_); |
| 268 | if (o) { |
| 269 | timer_.add(o); |
| 270 | } |
| 271 | |
| 272 | long long next = timer_.trigger(); |
| 273 | long long curr = get_curr_stamp(); |
| 274 | if (next == -1) { |
| 275 | delay_ = 100; |
| 276 | } else { |
| 277 | delay_ = next - curr; |
| 278 | if (delay_ < 0) { |
| 279 | delay_ = 1; |
| 280 | } |
| 281 | } |
| 282 | |
| 283 | lock_.lock(); |
| 284 | typename std::vector<T*>::iterator it; |
| 285 | for (it = timer_del_.begin(); it != timer_del_.end(); ++it) { |
| 286 | timer_.del(*it); |
| 287 | } |
| 288 | timer_del_.clear(); |
| 289 | lock_.unlock(); |
| 290 | } |
| 291 | return NULL; |
| 292 | } |
| 293 | |
| 294 | private: |
| 295 | long long delay_; |