@override
| 253 | private: |
| 254 | // @override |
| 255 | void* run() { |
| 256 | while (!stop_) { |
| 257 | T* o = mbox_.pop(delay_); |
| 258 | if (o) { |
| 259 | timer_.add(o); |
| 260 | } |
| 261 | |
| 262 | long long next = timer_.trigger(); |
| 263 | long long curr = get_curr_stamp(); |
| 264 | if (next == -1) { |
| 265 | delay_ = 100; |
| 266 | } else { |
| 267 | delay_ = next - curr; |
| 268 | if (delay_ < 0) { |
| 269 | delay_ = 1; |
| 270 | } |
| 271 | } |
| 272 | |
| 273 | lock_.lock(); |
| 274 | typename std::vector<T*>::iterator it; |
| 275 | for (it = timer_del_.begin(); it != timer_del_.end(); ++it) { |
| 276 | timer_.del(*it); |
| 277 | } |
| 278 | timer_del_.clear(); |
| 279 | lock_.unlock(); |
| 280 | } |
| 281 | return NULL; |
| 282 | } |
| 283 | |
| 284 | private: |
| 285 | long long delay_; |