Merge commit '3307ff377b32a791fcf7ba57a64fcdc79adcf230'

This commit is contained in:
Benjamin Vedder 2022-02-01 21:51:54 +01:00
commit d700a40a24
2 changed files with 21 additions and 10 deletions

View File

@ -457,32 +457,42 @@ int main(int argc, char **argv) {
lbm_load_and_define_program(&string_tok, "prelude");
lbm_continue_eval();
/* Something better is needed.
this sleep ís to ensure the string is alive until parsing
/* Something better is needed.
this sleep ís to ensure the string is alive until parsing
is done */
sleep_callback(10000);
} else if (strncmp(str, ":send", 5) == 0) {
int id;
int i_val;
if (sscanf(str + 5, "%d%d", &id, &i_val) == 2) {
lbm_pause_eval();
while(lbm_get_eval_state() != EVAL_CPS_STATE_PAUSED) {
sleep_callback(10);
}
if (lbm_send_message((lbm_cid)id, lbm_enc_i(i_val)) == 0) {
printf("Could not send message\n");
}
lbm_continue_eval();
} else {
printf("Incorrect arguments to send\n");
}
} else {
} else if (strncmp(str, ":pause", 6) == 0) {
lbm_pause_eval_with_gc(30);
while(lbm_get_eval_state() != EVAL_CPS_STATE_PAUSED) {
sleep_callback(10);
}
printf("Evaluator paused\n");
} else if (strncmp(str, ":continue", 9) == 0) {
lbm_continue_eval();
} else if (strncmp(str, ":step", 5) == 0) {
lbm_step_eval();
} else {
/* Get exclusive access to the heap */
lbm_pause_eval();
while(lbm_get_eval_state() != EVAL_CPS_STATE_PAUSED) {
@ -497,8 +507,8 @@ int main(int argc, char **argv) {
lbm_continue_eval();
printf("started ctx: %u\n", cid);
/* Something better is needed.
this sleep ís to ensure the string is alive until parsing
/* Something better is needed.
this sleep ís to ensure the string is alive until parsing
is done */
sleep_callback(10000);
}

View File

@ -1927,7 +1927,7 @@ void lbm_run_eval(void){
eval_cps_run_state = EVAL_CPS_STATE_RUNNING;
break;
case EVAL_CPS_STATE_STEP:
eval_cps_run_state = EVAL_CPS_STATE_PAUSED;
eval_cps_next_state = EVAL_CPS_STATE_PAUSED;
break;
case EVAL_CPS_STATE_PAUSED:
if (eval_cps_run_state != EVAL_CPS_STATE_PAUSED) {
@ -1943,6 +1943,7 @@ void lbm_run_eval(void){
eval_running = false;
continue;
default:
eval_cps_run_state = eval_cps_next_state;
break;
}