MCPcopy Create free account
hub / github.com/WasmEdge/WasmEdge / acquireTimer

Method acquireTimer

lib/host/wasi/inode-linux.cpp:1442–1457  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1440}
1441
1442WasiExpect<Poller::Timer>
1443PollerContext::acquireTimer(__wasi_clockid_t Clock) noexcept {
1444 std::unique_lock Lock(TimerMutex);
1445 if (auto &Timers = TimerPool.try_emplace(Clock).first->second;
1446 Timers.empty()) {
1447 Poller::Timer Result(Clock);
1448 if (auto Res = Result.create(); unlikely(!Res)) {
1449 return WasiUnexpect(fromErrNo(errno));
1450 }
1451 return Result;
1452 } else {
1453 Poller::Timer Result(std::move(Timers.back()));
1454 Timers.pop_back();
1455 return Result;
1456 }
1457}
1458
1459void PollerContext::releaseTimer(Poller::Timer &&Timer) noexcept {
1460 std::unique_lock Lock(TimerMutex);

Callers 1

clockMethod · 0.80

Calls 6

unlikelyFunction · 0.85
WasiUnexpectFunction · 0.85
backMethod · 0.80
fromErrNoFunction · 0.70
emptyMethod · 0.45
createMethod · 0.45

Tested by

no test coverage detected