develooper Front page | perl.perl5.porters | Postings from April 2000

-Dusethread woes

Thread Next
Doug MacEachern
April 14, 2000 15:12
-Dusethread woes
Message ID:
around 5.5.670-ish, i wrote a test program that fires off 3 pthreads,
each of which has a Perl interpreter created from perl_clone() before the 
threads were created.  the 3 threads concurrently call Perl subroutines,
worked like a charm.  it's now broken with 5.6.0

gcc -E expands this:
static void test(pTHXo)

static void test(register PerlInterpreter *my_perl  )
    extern int Perl___notused  ; register SV **sp = (*Perl_Tstack_sp_ptr(((PerlInterpreter *)pthread_getspecific((*Perl_Gthr_key_ptr(((void *)0) )) ) )   ))   ;

dSP; core dumps when being called concurrently.

i would expect that to be more like:
register SV **sp = my_perl->Tstack_sp;

if i tweak thread.h like so:
#if defined(USE_THREADS) /*|| defined(USE_ITHREADS)*/
and perlapi.h:
#if defined(PERL_OBJECT) /*|| defined (MULTIPLICITY)*/

then #define PERL_GET_INTERP my_perl

dSP no longer core dumps, nor does ENTER;SAVETMPS;, etc., but of course
does once inside the libperl.a runtime.

i just tried to Configure -des -Duseithreads -Dusemultiplicity
to see if that would help, but useithreads ends up == 'undef'

any insight here?  i'm going to try re-installing 5.5.670 in the meantime.

Summary of my perl5 (revision 5.0 version 6 subversion 0) configuration:
    osname=linux, osvers=2.2.7, archname=i686-linux-thread-multi
    uname='linux mojo 2.2.7 #3 smp thu may 13 13:13:23 pdt 1999 i686 unknown '
    config_args='-des -Dprefix=/usr/local/ithrperl -Dusethreads'
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=define use5005threads=undef useithreads=define usemultiplicity=define
    useperlio=undef d_sfio=undef uselargefiles=define 
    use64bitint=undef use64bitall=undef uselongdouble=undef usesocks=undef
    cc='cc', optimize='-O2', gccversion=egcs-2.91.66 19990314 (egcs-1.1.2 release)
    cppflags='-D_REENTRANT -fno-strict-aliasing -I/usr/local/include'
    ccflags ='-D_REENTRANT -fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64'
    stdchar='char', d_stdstdio=define, usevfork=false
    intsize=4, longsize=4, ptrsize=4, doublesize=8
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
    ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=4
    alignbytes=4, usemymalloc=n, prototype=define
  Linker and Libraries:
    ld='cc', ldflags =' -L/usr/local/lib'
    libpth=/usr/local/lib /lib /usr/lib
    libs=-lnsl -lndbm -lgdbm -ldb -ldl -lm -lpthread -lc -lposix -lcrypt
    libc=, so=so, useshrplib=false, libperl=libperl.a
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic'
    cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib'

Characteristics of this binary (from libperl): 
  Built under linux
  Compiled at Apr 14 2000 13:44:35

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About