I have a C API which takes a callback from the mJS world (including the
void * parameter) and calls that callback some time later from another RTOS thread (this is ESP32, so FreeRTOS). The thread that is doing the calling-back is allocated 8 kbytes of stack.
If I do something simple, like
print("Hello.\n"), in the mJS callback then all works fine but when I do anything more adventurous: perform some processing on received data, access other mJS global, variables, I get random errors, e.g. mJS complains that the global variable is not defined or even that
My question is: is it safe to call back into mJS from another RTOS thread? If so then I guess I must just be suffering from stack overflow or a waggly pointer.