Problems? Is your data what you think it is? | |
PerlMonks |
PL_malloc_mutex in XSby finisterra (Initiate) |
on Jul 15, 2014 at 09:49 UTC ( [id://1093665]=perlquestion: print w/replies, xml ) | Need Help?? |
finisterra has asked for the wisdom of the Perl Monks concerning the following question:
Hi all! I work with perl version 5.14.2-6ubuntu2.4. Recently I had a problem writing a new XS module. In my unsafe sighandler I want check, if PL_malloc_mutex is free, so I can work in my perl part of sighandler code. So, I try to compile this code: 1 #include "EXTERN.h" 2 #include "perl.h" 3 #include "XSUB.h" 4 5 #include "ppport.h" 6 7 MODULE = Timeout PACKAGE = Timeout 8 9 void 10 try_get_mutex() 11 CODE: 12 if (pthread_mutex_trylock(PL_malloc_mutex) == EBUSY) { 13 printf("Busy!\n"); 14 } else { 15 printf("Free!\n"); 16 } But I have an error: cc -c -I. -D_REENTRANT -D_GNU_SOURCE -DDEBIAN -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -g -DVERSION=\"0.01\" -DXS_VERSION=\"0.01\" -fPIC "-I/usr/lib/perl/5.14/CORE" Timeout.c Timeout.xs: In function ‘XS_Timeout_try_get_mutex’: Timeout.xs:12:29: error: ‘PL_malloc_mutex’ undeclared (first use in this function) Timeout.xs:12:29: note: each undeclared identifier is reported only once for each function it appears in Makefile:334: recipe for target 'Timeout.o' failed make: *** Timeout.o Error 1 shell returned 2 Including perlapi.h didn't help me. Plase, help me, how can I get this var in my XS code?
Back to
Seekers of Perl Wisdom
|
|