From fd15a49eb477b345e97ca3bbd6cde135cd0d6583 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sat, 3 Sep 2022 10:50:53 +0000 Subject: Ractor compatibility 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) { -- cgit v1.2.3-24-ge0c7