| 3372 | } |
| 3373 | |
| 3374 | TSAction |
| 3375 | TSContScheduleOnPool(TSCont contp, TSHRTime timeout, TSThreadPool tp) |
| 3376 | { |
| 3377 | sdk_assert(sdk_sanity_check_iocore_structure(contp) == TS_SUCCESS); |
| 3378 | |
| 3379 | /* ensure we are on a EThread */ |
| 3380 | sdk_assert(sdk_sanity_check_null_ptr((void *)this_ethread()) == TS_SUCCESS); |
| 3381 | |
| 3382 | FORCE_PLUGIN_SCOPED_MUTEX(contp); |
| 3383 | |
| 3384 | INKContInternal *i = reinterpret_cast<INKContInternal *>(contp); |
| 3385 | |
| 3386 | if (ink_atomic_increment(static_cast<int *>(&i->m_event_count), 1) < 0) { |
| 3387 | ink_assert(!"not reached"); |
| 3388 | } |
| 3389 | |
| 3390 | EventType etype; |
| 3391 | |
| 3392 | switch (tp) { |
| 3393 | case TS_THREAD_POOL_NET: |
| 3394 | etype = ET_NET; |
| 3395 | break; |
| 3396 | case TS_THREAD_POOL_TASK: |
| 3397 | etype = ET_TASK; |
| 3398 | break; |
| 3399 | case TS_THREAD_POOL_DNS: |
| 3400 | etype = ET_DNS; |
| 3401 | break; |
| 3402 | case TS_THREAD_POOL_UDP: |
| 3403 | etype = ET_UDP; |
| 3404 | break; |
| 3405 | default: |
| 3406 | etype = ET_TASK; |
| 3407 | break; |
| 3408 | } |
| 3409 | |
| 3410 | TSAction action; |
| 3411 | if (timeout == 0) { |
| 3412 | action = reinterpret_cast<TSAction>(eventProcessor.schedule_imm(i, etype)); |
| 3413 | } else { |
| 3414 | action = reinterpret_cast<TSAction>(eventProcessor.schedule_in(i, HRTIME_MSECONDS(timeout), etype)); |
| 3415 | } |
| 3416 | |
| 3417 | /* This is a hack. Should be handled in ink_types */ |
| 3418 | action = reinterpret_cast<TSAction>(reinterpret_cast<uintptr_t>(action) | 0x1); |
| 3419 | return action; |
| 3420 | } |
| 3421 | |
| 3422 | TSAction |
| 3423 | TSContScheduleOnThread(TSCont contp, TSHRTime timeout, TSEventThread ethread) |