| 486 | } |
| 487 | |
| 488 | WasmResult |
| 489 | Context::setTimerPeriod(std::chrono::milliseconds period, uint32_t *timer_token_ptr) |
| 490 | { |
| 491 | Wasm *wasm = this->wasm(); |
| 492 | Context *root_context = this->root_context(); |
| 493 | TSMutexLock(wasm->mutex()); |
| 494 | if (!wasm->existsTimerPeriod(root_context->id())) { |
| 495 | Dbg(dbg_ctl, "[%s] no previous timer period set", __FUNCTION__); |
| 496 | TSCont contp = root_context->scheduler_cont(); |
| 497 | if (contp != nullptr) { |
| 498 | Dbg(dbg_ctl, "[%s] scheduling continuation for timer", __FUNCTION__); |
| 499 | TSContDataSet(contp, root_context); |
| 500 | TSContScheduleOnPool(contp, static_cast<TSHRTime>(period.count()), TS_THREAD_POOL_NET); |
| 501 | } |
| 502 | } |
| 503 | |
| 504 | wasm->setTimerPeriod(root_context->id(), period); |
| 505 | *timer_token_ptr = 0; |
| 506 | TSMutexUnlock(wasm->mutex()); |
| 507 | return WasmResult::Ok; |
| 508 | } |
| 509 | |
| 510 | BufferInterface * |
| 511 | Context::getBuffer(WasmBufferType type) |
nothing calls this directly
no test coverage detected