| 202 | } |
| 203 | |
| 204 | TS_INLINE std::vector<TSAction> |
| 205 | EventProcessor::schedule_entire(Continuation *cont, ink_hrtime t, ink_hrtime p, EventType et, int callback_event, void *cookie) |
| 206 | { |
| 207 | ThreadGroupDescriptor *tg = &thread_group[et]; |
| 208 | EThread *curr_thread = this_ethread(); |
| 209 | |
| 210 | std::vector<TSAction> actions; |
| 211 | |
| 212 | for (int i = 0; i < tg->_count; i++) { |
| 213 | Event *e = eventAllocator.alloc(); |
| 214 | |
| 215 | e->ethread = tg->_thread[i]; |
| 216 | e->callback_event = callback_event; |
| 217 | e->cookie = cookie; |
| 218 | |
| 219 | if (t == 0 && p == 0) { |
| 220 | e->init(cont, 0, 0); |
| 221 | } else if (t != 0 && p == 0) { |
| 222 | e->init(cont, ink_get_hrtime() + t, 0); |
| 223 | } else if (t == 0 && p != 0) { |
| 224 | if (p < 0) { |
| 225 | e->init(cont, p, p); |
| 226 | } else { |
| 227 | e->init(cont, ink_get_hrtime() + p, p); |
| 228 | } |
| 229 | } else { |
| 230 | ink_assert(!"not reached"); |
| 231 | } |
| 232 | |
| 233 | e->mutex = new_ProxyMutex(); |
| 234 | |
| 235 | if (curr_thread != nullptr && e->ethread == curr_thread) { |
| 236 | e->ethread->EventQueueExternal.enqueue_local(e); |
| 237 | } else { |
| 238 | e->ethread->EventQueueExternal.enqueue(e); |
| 239 | } |
| 240 | |
| 241 | /* This is a hack. Should be handled in ink_types */ |
| 242 | actions.push_back((TSAction)((uintptr_t) reinterpret_cast<TSAction>(e) | 0x1)); |
| 243 | } |
| 244 | |
| 245 | return actions; |
| 246 | } |
no test coverage detected