From: Eric Wong <e@80x24.org>
To: mwrap-public@80x24.org
Subject: [PATCH 1/2] Ractor compatibility
Date: Sat, 3 Sep 2022 11:20:19 +0000 [thread overview]
Message-ID: <20220903112020.2317141-2-e@80x24.org> (raw)
In-Reply-To: <20220903112020.2317141-1-e@80x24.org>
We can no longer depend on having GVL/GIL when we have a Ruby
execution context, so so make `kbuf' thread-specific to avoid
data corruption.
This was ported from the Perl5 version, since Perl5 has had
MVM/Ractor-like abilities with native threads for decades,
despite the Perl5 ecosystem largely avoids and discourages
threads.
---
ext/mwrap/mwrap.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/ext/mwrap/mwrap.c b/ext/mwrap/mwrap.c
index 1d6baec..90f560e 100644
--- a/ext/mwrap/mwrap.c
+++ b/ext/mwrap/mwrap.c
@@ -308,7 +308,9 @@ struct alloc_hdr {
size_t size;
};
-static char kbuf[PATH_MAX + INT2STR_MAX + sizeof(struct alloc_hdr) + 2];
+static MWRAP_TSD char kbuf[
+ PATH_MAX + INT2STR_MAX + sizeof(struct alloc_hdr) + 2
+];
static struct alloc_hdr *ptr2hdr(void *p)
{
next prev parent reply other threads:[~2022-09-03 11:20 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-03 11:20 [PATCH 0/2] various safety fixes from the Perl side Eric Wong
2022-09-03 11:20 ` Eric Wong [this message]
2022-09-03 11:20 ` [PATCH 2/2] paranoid safety fix to clamp pathnames to PATH_MAX 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
List information: https://80x24.org/mwrap/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220903112020.2317141-2-e@80x24.org \
--to=e@80x24.org \
--cc=mwrap-public@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.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mwrap.git/
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).