dumping ground for random patches and texts
 help / color / mirror / Atom feed
From: Eric Wong <e@80x24.org>
To: spew@80x24.org
Subject: [PATCH 2/2] wip
Date: Sun,  9 Sep 2018 08:35:14 +0000	[thread overview]
Message-ID: <20180909083514.13957-2-e@80x24.org> (raw)
In-Reply-To: <20180909083514.13957-1-e@80x24.org>

---
 cont.c | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/cont.c b/cont.c
index 0311e01f99..5d203bfdaf 100644
--- a/cont.c
+++ b/cont.c
@@ -386,9 +386,6 @@ cont_free(void *ptr)
 	}
 #else /* not WIN32 */
 	if (fib->ss_sp != NULL) {
-	    if (cont->type == ROOT_FIBER_CONTEXT) {
-		rb_bug("Illegal root fiber parameter");
-	    }
 	    munmap((void*)fib->ss_sp, fib->ss_size);
 	}
 	else {
@@ -1800,12 +1797,14 @@ rb_fiber_terminate(rb_fiber_t *fib, int need_interrupt)
     fib->context.uc_stack.ss_sp = NULL;
 #endif
 #ifdef MAX_MACHINE_STACK_CACHE
-    /* Ruby must not switch to other thread until storing terminated_machine_stack */
-    terminated_machine_stack.ptr = fib->ss_sp;
-    terminated_machine_stack.size = fib->ss_size / sizeof(VALUE);
-    fib->ss_sp = NULL;
-    fib->cont.machine.stack = NULL;
-    fib->cont.machine.stack_size = 0;
+    if (fib->ss_sp) {
+        /* Ruby must not switch to other thread until storing terminated_machine_stack */
+        terminated_machine_stack.ptr = fib->ss_sp;
+        terminated_machine_stack.size = fib->ss_size / sizeof(VALUE);
+        fib->ss_sp = NULL;
+        fib->cont.machine.stack = NULL;
+        fib->cont.machine.stack_size = 0;
+    }
 #endif
 
     ret_fib = return_fiber();
-- 
EW


  reply	other threads:[~2018-09-09  8:35 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-09  8:35 [PATCH 1/2] cont.c (fiber_memsize): do not rely on ROOT_FIBER_CONTEXT Eric Wong
2018-09-09  8:35 ` Eric Wong [this message]
  -- strict thread matches above, loose matches on Subject: below --
2023-05-13 22:16 [PATCH 1/2] search: add comments wrt codesearch, reduce ops Eric Wong
2023-05-13 22:16 ` [PATCH 2/2] WIP Eric Wong
2023-05-04 11:07 [PATCH 1/2] reuse open(2) from rb_file_load_ok on POSIX-like system Eric Wong
2023-05-04 11:07 ` [PATCH 2/2] wip Eric Wong
2023-04-17 23:06 [PATCH 1/2] reuse open(2) from rb_file_load_ok on POSIX-like system Eric Wong
2023-04-17 23:06 ` [PATCH 2/2] wip Eric Wong
2021-01-15 10:24 [PATCH 1/2] lei_to_mail: prepare Eric Wong
2021-01-15 10:24 ` [PATCH 2/2] wip Eric Wong
2020-03-31  6:42 [PATCH 1/2] v2writable: index Message-IDs w/ spaces properly Eric Wong
2020-03-31  6:42 ` [PATCH 2/2] WIP Eric Wong
2019-11-03  3:17 [PATCH 1/2] edit: hoist out prompt functions into sub functions Eric Wong
2019-11-03  3:17 ` [PATCH 2/2] wip Eric Wong
2019-09-23  3:16 [PATCH 1/2] edit: hoist out prompt functions into sub functions ew
2019-09-23  3:16 ` [PATCH 2/2] wip ew
2019-01-07  8:02 [PATCH 1/2] hoist out resolve_repo_dir from -index Eric Wong
2019-01-07  8:02 ` [PATCH 2/2] wip Eric Wong
2018-09-09  8:00 [PATCH 1/2] test_fiber: show crash on GC after forking Eric Wong
2018-09-09  8:00 ` [PATCH 2/2] wip Eric Wong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180909083514.13957-2-e@80x24.org \
    --to=e@80x24.org \
    --cc=spew@80x24.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).