MCPcopy Create free account
hub / github.com/Distributive-Network/PythonMonkey / cancelByTimeoutId

Function cancelByTimeoutId

src/internalBinding/timers.cc:55–70  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

53}
54
55static bool cancelByTimeoutId(JSContext *cx, unsigned argc, JS::Value *vp) {
56 JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
57 double timeoutID = args.get(0).toNumber();
58
59 args.rval().setUndefined();
60
61 // Retrieve the AsyncHandle by `timeoutID`
62 AsyncHandle *handle = AsyncHandle::fromId((uint32_t)timeoutID);
63 if (!handle) return true; // does nothing on invalid timeoutID
64
65 // Cancel this job on the Python event-loop
66 handle->cancel();
67 handle->removeRef();
68
69 return true;
70}
71
72static bool timerHasRef(JSContext *cx, unsigned argc, JS::Value *vp) {
73 JS::CallArgs args = JS::CallArgsFromVp(argc, vp);

Callers 1

clearTimeoutFunction · 0.85

Calls 3

getMethod · 0.80
cancelMethod · 0.80
removeRefMethod · 0.80

Tested by

no test coverage detected