Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion api-test.c
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ static void cfunctions(void)

#define MAX_TIME 10

static int timeout_interrupt_handler(JSRuntime *rt, void *opaque)
static int timeout_interrupt_handler(JSContext *ctx, void *opaque)
{
int *time = (int *)opaque;
return (*time)++ > MAX_TIME;
Expand Down
4 changes: 2 additions & 2 deletions quickjs-libc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1085,14 +1085,14 @@ static JSValue js_std_gc(JSContext *ctx, JSValueConst this_val,
return JS_UNDEFINED;
}

static int interrupt_handler(JSRuntime *rt, void *opaque)
static int interrupt_handler(JSContext *ctx, void *opaque)
{
JSThreadState *ts = opaque;

if (1 & (os_pending_signals >> SIGINT))
return 1;
if (ts->prev_interrupt_handler)
return ts->prev_interrupt_handler(rt, ts->prev_interrupt_opaque);
return ts->prev_interrupt_handler(ctx, ts->prev_interrupt_opaque);
return 0;
}

Expand Down
4 changes: 2 additions & 2 deletions quickjs.c
Original file line number Diff line number Diff line change
Expand Up @@ -8656,7 +8656,7 @@ static no_inline __exception int __js_poll_interrupts(JSContext *ctx)
JSRuntime *rt = ctx->rt;
ctx->interrupt_counter = JS_INTERRUPT_COUNTER_INIT;
if (rt->interrupt_handler) {
if (rt->interrupt_handler(rt, rt->interrupt_opaque)) {
if (rt->interrupt_handler(ctx, rt->interrupt_opaque)) {
JS_ThrowInterrupted(ctx);
return -1;
}
Expand Down Expand Up @@ -49661,7 +49661,7 @@ int lre_check_timeout(void *opaque)
JSContext *ctx = opaque;
JSRuntime *rt = ctx->rt;
return (rt->interrupt_handler &&
rt->interrupt_handler(rt, rt->interrupt_opaque));
rt->interrupt_handler(ctx, rt->interrupt_opaque));
}

void *lre_realloc(void *opaque, void *ptr, size_t size)
Expand Down
2 changes: 1 addition & 1 deletion quickjs.h
Original file line number Diff line number Diff line change
Expand Up @@ -1187,7 +1187,7 @@ typedef void JSHostPromiseRejectionTracker(JSContext *ctx, JSValueConst promise,
JS_EXTERN void JS_SetHostPromiseRejectionTracker(JSRuntime *rt, JSHostPromiseRejectionTracker *cb, void *opaque);

/* return != 0 if the JS code needs to be interrupted */
typedef int JSInterruptHandler(JSRuntime *rt, void *opaque);
typedef int JSInterruptHandler(JSContext *ctx, void *opaque);
JS_EXTERN void JS_SetInterruptHandler(JSRuntime *rt, JSInterruptHandler *cb, void *opaque);
/* if can_block is true, Atomics.wait() can be used */
JS_EXTERN void JS_SetCanBlock(JSRuntime *rt, bool can_block);
Expand Down
2 changes: 1 addition & 1 deletion run-test262.c
Original file line number Diff line number Diff line change
Expand Up @@ -1728,7 +1728,7 @@ JSContext *JS_NewCustomContext(JSRuntime *rt)
return ctx;
}

static int interrupt_handler(JSRuntime *rt, void *opaque)
static int interrupt_handler(JSContext *ctx, void *opaque)
{
int *interrupt_countdown = opaque;
return !--*interrupt_countdown;
Expand Down
Loading