Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: perl5.005_61 with both usethreads and usemultiplicity does n ot run 'thread' test #442

Closed
p5pRT opened this issue Aug 26, 1999 · 2 comments

Comments

@p5pRT
Copy link

p5pRT commented Aug 26, 1999

Migrated from rt.perl.org#1283 (status was 'resolved')

Searchable as RT1283$

@p5pRT
Copy link
Author

p5pRT commented Aug 26, 1999

From vkonovalov@lucent.com

I've built 5.005_61 with borland-c with options usethreads
and usemultiplicity turned on.

MS-Windows displays 'access violation' dialog box when running
thread tests. (All other tests are ok).

lib/thread..........dubious
  Test returned status 5 (wstat 1280, 0x500)
DIED. FAILED tests 2-18
  Failed 17/18 tests, 5.56% okay
lib/tie-push........ok
lib/tie-stdarray....ok
lib/tie-stdhandle...ok
lib/tie-stdpush.....ok
lib/timelocal.......ok
lib/trig............ok
Failed Test Status Wstat Total Fail Failed List of failed



lib/thread.t 5 1280 18 17 94.44% 2-18
25 tests and 75 subtests skipped.
Failed 1/219 test scripts, 99.54% okay. 17/8655 subtests failed, 99.80%
okay.
dmake.exe​: Error code 32, while making 'test'


Site configuration information for perl 5.00561​:

Summary of my perl5 (revision 5.0 version 5 subversion 61) configuration​:
  Platform​:
  osname=MSWin32, osvers=4.0, archname=MSWin32-x86-thread
  uname=''
  config_args='undef'
  hint=recommended, useposix=true, d_sigaction=undef
  usethreads=define useperlio=undef d_sfio=undef
  use64bits=undef usemultiplicity=define
  Compiler​:
  cc='bcc32', optimize='-O2 -D_RTLDLL', gccversion=
  cppflags='-DWIN32'
  ccflags ='-O2 -D_RTLDLL -DWIN32 -DPERL_IMPLICIT_CONTEXT'
  stdchar='unsigned char', d_stdstdio=define, usevfork=false
  intsize=4, longsize=4, ptrsize=4, doublesize=8
  d_longlong=undef, longlongsize=8, d_longdbl=define, longdblsize=10
  alignbytes=8, usemymalloc=n, prototype=define
  Linker and Libraries​:
  ld='tlink32', ldflags =' -L"e​:\borland\bc5\lib"'
  libpth=e​:\borland\bc5\lib
  libs= import32.lib cw32mti.lib odbc32.lib odbccp32.lib
  libc=cw32mti.lib, so=dll, useshrplib=yes, libperl=perl.lib
  Dynamic Linking​:
  dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags='-tWD'
  cccdlflags=' ', lddlflags='-Tpd -L"e​:\borland\bc5\lib"'

Locally applied patches​:
 


@​INC for perl 5.00561​:
  d​:/work/PerlScripts/pleps
  C​:/Work/PerlCompile/perl5.005_61/lib
  .


Environment for perl 5.00561​:
  HOME=c​:\gnuwin32\b20\H-i586-cygwin32
  LANG (unset)
  LANGUAGE (unset)
  LD_LIBRARY_PATH (unset)
  LOGDIR (unset)
  PATH=C​:\Program
Files\Far;C​:\Perl\bin;c​:\bin;D​:\WINNT\SYSTEM32;D​:\WINNT;c​:\sh;c​:\gs;d​:\groff
\exe;c​:\gnuwin32\b20\H-i586-cygwin32\bin;c​:\sgml\bin;c​:\OmniMark\omci-4_0\bi
n;E​:\Borland\BC5\BIN;E​:\Borland\CBuilder4\Bin\;E​:\Borland\CBUILD~1\Projects\
Bpl;;C​:\WN16\BIN
  PERL5LIB=d​:/work/PerlScripts/pleps
  PERL_BADLANG (unset)
  SHELL (unset)

@p5pRT
Copy link
Author

p5pRT commented Aug 26, 1999

From @gsar

On Thu, 26 Aug 1999 19​:03​:58 +0400, "Konovalov, Vadim" wrote​:

This is a bug report for perl from vkonovalov@​lucent.com,
generated with the help of perlbug 1.27 running under perl 5.00561.

I've built 5.005_61 with borland-c with options usethreads
and usemultiplicity turned on.

MS-Windows displays 'access violation' dialog box when running
thread tests. (All other tests are ok).

lib/thread..........dubious
Test returned status 5 (wstat 1280, 0x500)
DIED. FAILED tests 2-18
Failed 17/18 tests, 5.56% okay

Try this patch.

Note that what's in there currently by way of usethreads+usemultiplicity
support is rather inefficient. Instead of using thr->interp to get at
the "current" interpreter, I went for getting it from TLS via
PERL_GET_INTERP (see embed.pl), just to prove the concept and get it
working in the time I had. Doing it the correct way needs identifying the
few places where thr->interp will be needed before thr is initialized and
fixing them to either use PERL_GET_INTERP or reorder where the thr init
happens.

People using -Dusemultiplicity should also note that PERL_GET_INTERP
defaults to an implementation that just gets and sets PL_curinterp
(a simple global). Thus, if you want to test concurrent interpreters,
you will need to​:

  1) set up a couple of functions to get and set a TLS slot
  and #define PERL_[GS]ET_INTERP in a suitable place before the
  defaults in perl.h.
  2) have pthreads available and link to the pthreads library just so
  Perl can get at pthread_[gs]et_specific()

Concurrent interpreters should work out of the box on win32, where
[GS]etPerlInterpreter() are already available. Other platforms will need
to translate what's in win32.h and perllib.c to the pthreads equivalent.

Sarathy
gsar@​activestate.com

Inline Patch
-----------------------------------8<-----------------------------------
Change 4032 by gsar@auger on 1999/08/26 23:53:33

	new thread should set current interp in TLS

Affected files ...

... //depot/perl/ext/Thread/Thread.xs#43 edit

Differences ...

==== //depot/perl/ext/Thread/Thread.xs#43 (text) ====
Index: perl/ext/Thread/Thread.xs
--- perl/ext/Thread/Thread.xs.~1~	Thu Aug 26 16:53:43 1999
+++ perl/ext/Thread/Thread.xs	Thu Aug 26 16:53:43 1999
@@ -86,9 +86,14 @@
     I32 oldscope = PL_scopestack_ix;
     I32 retval;
     SV *sv;
-    AV *av = newAV();
+    AV *av;
     int i, ret;
     dJMPENV;
+
+#if defined(MULTIPLICITY)
+    PERL_SET_INTERP(thr->interp);
+#endif
+
     DEBUG_S(PerlIO_printf(PerlIO_stderr(), "new thread %p waiting to start\n",
 			  thr));
 
@@ -114,6 +119,7 @@
     DEBUG_S(PerlIO_printf(PerlIO_stderr(), "new thread %p starting at %s\n",
 			  thr, SvPEEK(TOPs)));
 
+    av = newAV();
     sv = POPs;
     PUTBACK;
     ENTER;
End of Patch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant