From da3037102d14035ceb06aa366254b6e54875a5c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Tainon?= Date: Wed, 22 May 2024 16:04:13 +0200 Subject: [PATCH] [Fix] Highlight in C --- frontend/stepper/abstract_runner.ts | 7 ++++--- frontend/stepper/c/unix_runner.ts | 2 ++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/frontend/stepper/abstract_runner.ts b/frontend/stepper/abstract_runner.ts index 7eefa5cc..acd30e2b 100644 --- a/frontend/stepper/abstract_runner.ts +++ b/frontend/stepper/abstract_runner.ts @@ -164,10 +164,10 @@ export default abstract class AbstractRunner { log.getLogger('multithread').debug('[multithread] default create new thread'); } - public registerNewThread(threadData: any): number { - log.getLogger('multithread').debug('[multithread] register new thread', threadData, threadData.length); + public registerNewThread(threadData: any = null): number { + log.getLogger('multithread').debug('[multithread] register new thread', threadData); const newThreadId = this.maxThreadId; - this.threads[newThreadId] = [...threadData]; + this.threads[newThreadId] = threadData ? [...threadData] : null; this.maxThreadId++; return newThreadId; @@ -195,6 +195,7 @@ export default abstract class AbstractRunner { } public swapCurrentThreadId(newThreadId: number): void { + this.currentThreadId = newThreadId; } public currentThreadFinished(newThreadId: number): void { diff --git a/frontend/stepper/c/unix_runner.ts b/frontend/stepper/c/unix_runner.ts index 83e3ddee..835ab00a 100644 --- a/frontend/stepper/c/unix_runner.ts +++ b/frontend/stepper/c/unix_runner.ts @@ -49,6 +49,8 @@ export default class UnixRunner extends AbstractRunner { } public async programInitialization(stepperContext: StepperContext): Promise { + this.registerNewThread(); + while (!inUserCode(stepperContext.state)) { /* Mutate the stepper context to advance execution by a single step. */ const effects = C.step(stepperContext.state.programState);