Skip to content

Commit

Permalink
Fixed crash when trying to halt computer; debug adapter race condition
Browse files Browse the repository at this point in the history
  • Loading branch information
MCJack123 committed Mar 26, 2024
1 parent 964ce6e commit a601d2c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion craftos2-lua
Submodule craftos2-lua updated 2 files
+2 −2 src/ldo.c
+2 −1 src/lvm.c
2 changes: 2 additions & 0 deletions src/peripheral/debug_adapter.cpp
Expand Up @@ -22,6 +22,7 @@ static void forwardInput();
#endif

static debug_adapter * stdio_debugger = NULL;
static std::mutex stdio_debugger_lock;
static std::thread * inputThread = NULL;

static std::string dap_input(lua_State *L, void* arg) {
Expand Down Expand Up @@ -49,6 +50,7 @@ static void forwardInput() {
}
std::cerr << sz << "\n";
for (int i = 0; i < sz; i++) data += std::cin.get();
std::lock_guard<std::mutex> lock(stdio_debugger_lock);
if (stdio_debugger != NULL) {
std::string * str = new std::string(data);
queueEvent(stdio_debugger->monitor, dap_input, str);
Expand Down

0 comments on commit a601d2c

Please sign in to comment.