Created
September 27, 2019 18:55
-
-
Save dogbert17/4180fe5cfba5b863295094a73c091df0 to your computer and use it in GitHub Desktop.
Attempt to avoid SEGV
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/io/procops.c b/src/io/procops.c | |
index 9c23b5e..61e2f62 100644 | |
--- a/src/io/procops.c | |
+++ b/src/io/procops.c | |
@@ -472,6 +472,7 @@ static void async_spawn_on_exit(uv_process_t *req, MVMint64 exit_status, int ter | |
MVMObject *done_cb = MVM_repr_at_key_o(tc, si->callbacks, | |
tc->instance->str_consts.done); | |
MVMOSHandle *os_handle; | |
+ uv_mutex_t *mutex; | |
if (!MVM_is_null(tc, done_cb)) { | |
MVMROOT(tc, done_cb, { | |
/* Get status. */ | |
@@ -494,10 +495,11 @@ static void async_spawn_on_exit(uv_process_t *req, MVMint64 exit_status, int ter | |
/* when invoked via MVMIOOps, close_stdin is already wrapped in a mutex */ | |
os_handle = (MVMOSHandle *) si->handle; | |
- uv_mutex_lock(os_handle->body.mutex); | |
+ mutex = os_handle->body.mutex; | |
+ uv_mutex_lock(mutex); | |
si->state = STATE_DONE; | |
close_stdin(tc, os_handle); | |
- uv_mutex_unlock(os_handle->body.mutex); | |
+ uv_mutex_unlock(mutex); | |
/* Close handle. */ | |
uv_close((uv_handle_t *)req, spawn_async_close); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment