1
0
mirror of https://github.com/rkd77/elinks.git synced 2025-01-03 14:57:44 -05:00
elinks/src/ecmascript/quickjs/heartbeat.h
Witold Filipczyk 29bf0ee9bb [dos,js] Try to add own timer ISR
The goal is to check if js scripts do not execute too long under DOS.
It may be buggy.
2022-06-12 22:14:49 +02:00

23 lines
689 B
C

#ifndef EL__ECMASCRIPT_QUICKJS_HEARTBEAT_H
#define EL__ECMASCRIPT_QUICKJS_HEARTBEAT_H
#include <quickjs/quickjs.h>
struct heartbeat {
LIST_HEAD(struct heartbeat);
int ttl; /* Time to live. This value is assigned when the
* script begins execution and is decremented every
* second. When it reaches 0, script execution is
* terminated. */
struct ecmascript_interpreter *interpreter;
};
struct heartbeat *add_heartbeat(struct ecmascript_interpreter *interpreter);
void check_heartbeats(void *data);
void done_heartbeat(struct heartbeat *hb);
int js_heartbeat_callback(JSRuntime *rt, void *opaque);
#endif