Subject: | Fails to build on threaded Perl 5.26.1 |
Build fails on threaded Perl 5.26.1 because of not passing perl context. Attached patch fixes it.
Subject: | Coro-Multicore-0.03-Fix-passing-context.patch |
From 07268b8259f5d58a6d13fce14295a193c43ad396 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
Date: Fri, 19 Jan 2018 09:45:10 +0100
Subject: [PATCH] Fix passing context
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Since Coro-Multicore-0.03, build fails with threaded Perl 5.26.1:
In file included from Multicore.xs:4:0:
Multicore.xs: In function 'pmapi_acquire':
/usr/lib64/perl5/CORE/perl.h:176:16: error: 'my_perl' undeclared (first use in this function); did you mean 'my_fork'?
# define aTHX my_perl
^
/usr/lib64/perl5/CORE/embedvar.h:38:18: note: in expansion of macro 'aTHX'
# define vTHX aTHX
^~~~
/usr/lib64/perl5/CORE/embedvar.h:335:22: note: in expansion of macro 'vTHX'
#define PL_top_env (vTHX->Itop_env)
^~~~
/usr/lib64/perl5/CORE/cop.h:131:6: note: in expansion of macro 'PL_top_env'
if (PL_top_env->je_prev) \
^~~~~~~~~~
Multicore.xs:251:5: note: in expansion of macro 'JMPENV_JUMP'
JMPENV_JUMP (jeret);
^~~~~~~~~~~
MultiCore.xs defines PERL_NO_GET_CONTEXT, thus pmapi_acquire() function needs explicit context argument to be have it available when calling JMPENV_JUMP() macro. See
<http://blogs.perl.org/users/nick_wellnhofer/2015/03/writing-xs-like-a-pro---perl-no-get-context-and-static-functions.html>.
Signed-off-by: Petr PÃsaÅ <ppisar@redhat.com>
---
Multicore.xs | 2 +-
perlmulticore.h | 6 +++---
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/Multicore.xs b/Multicore.xs
index 288e7bf..0c42a3d 100644
--- a/Multicore.xs
+++ b/Multicore.xs
@@ -219,7 +219,7 @@ pmapi_release (void)
}
static void
-pmapi_acquire (void)
+pmapi_acquire (pTHX)
{
int jeret;
struct tctx *ctx = X_TLS_GET (current_key);
diff --git a/perlmulticore.h b/perlmulticore.h
index 00ae152..0f6b920 100644
--- a/perlmulticore.h
+++ b/perlmulticore.h
@@ -153,7 +153,7 @@ START_EXTERN_C
struct perl_multicore_api
{
void (*pmapi_release)(void);
- void (*pmapi_acquire)(void);
+ void (*pmapi_acquire)(pTHX);
};
static void perl_multicore_init (void);
@@ -165,11 +165,11 @@ static struct perl_multicore_api *perl_multicore_api
= (struct perl_multicore_api *)&perl_multicore_api_init;
#define perlinterp_release() perl_multicore_api->pmapi_release ()
-#define perlinterp_acquire() perl_multicore_api->pmapi_acquire ()
+#define perlinterp_acquire() perl_multicore_api->pmapi_acquire (aTHX)
/* this is the release/acquire implementation used as fallback */
static void
-perl_multicore_nop (void)
+perl_multicore_nop (pTHX)
{
}
--
2.13.6