Here is the exact program:
===========
#!c:/perl/bin/perl.exe -w
use threads;
use strict;
my $thread1 = threads->create ( \&Test, "1" );
my $thread2 = threads->create ( \&Test, "2" );
$thread1->join;
$thread2->join;
exit;
sub Test {
my $test = shift;
print "\nHello World! - " . $test;
return $test;
}
#######################
Here is the Output of Perl -V
#######################
Summary of my perl5 (revision 5 version 6 subversion 1) configuration:
Platform:
osname=MSWin32, osvers=4.0, archname=MSWin32-x86-multi-thread
uname=''
config_args='undef'
hint=recommended, useposix=true, d_sigaction=undef
usethreads=undef use5005threads=undef useithreads=define
usemultiplicity=define
useperlio=undef d_sfio=undef uselargefiles=undef usesocks=undef
use64bitint=undef use64bitall=undef uselongdouble=undef
Compiler:
cc='cl', ccflags ='-nologo -O1 -MD -DNDEBUG -DWIN32 -D_CONSOLE
-DNO_STRICT -DHAVE_DES_FCRYPT -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS
-DPERL_MSVCRT_READFIX',
optimize='-O1 -MD -DNDEBUG',
cppflags='-DWIN32'
ccversion='', gccversion='', gccosandvers=''
intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
d_longlong=undef, longlongsize=8, d_longdbl=define, longdblsize=10
ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t',
lseeksize=4
alignbytes=8, usemymalloc=n, prototype=define
Linker and Libraries:
ld='link', ldflags ='-nologo -nodefaultlib -release
-libpath:"C:/Perl\lib\CORE" -machine:x86'
libpth="C:\Perl\lib\CORE"
libs= oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib
comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib netapi32.lib
uuid.lib wsock32.lib mpr.lib winmm.lib version.lib odbc32.lib odbccp32.lib
msvcrt.lib
perllibs= oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib
comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib netapi32.lib
uuid.lib wsock32.lib mpr.lib winmm.lib version.lib odbc32.lib odbccp32.lib
msvcrt.lib
libc=msvcrt.lib, so=dll, useshrplib=yes, libperl=perl56.lib
Dynamic Linking:
dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' '
cccdlflags=' ', lddlflags='-dll -nologo -nodefaultlib -release
-libpath:"C:/Perl\lib\CORE" -machine:x86'
Characteristics of this binary (from libperl):
Compile-time options: MULTIPLICITY USE_ITHREADS PERL_IMPLICIT_CONTEXT
PERL_IMPLICIT_SYS
Locally applied patches:
ActivePerl Build 633
Built under MSWin32
Compiled at Jun 17 2002 21:33:05
@INC:
C:/Perl/lib
C:/Perl/site/lib
.
###########################
> -----Urspr�ngliche Nachricht-----
> Von: Elizabeth Mattijsen [SMTP:[EMAIL PROTECTED]]
> Gesendet am: Montag, 13. Januar 2003 12:23
> An: Teifke Sascha ZFF
> Betreff: Re: AW: threads - Error
>
> At 12:09 +0100 1/13/03, Teifke Sascha ZFF wrote:
> > > perldoc perlthrtut
> > I've read them but they "use Thread" and I "use threads;". Aren't
> >they different?
>
> Hmmm... looks to me that you're looking at an old perldoc, pre 5.8.0.
> Which version of Perl are you using anyway.
>
Yes, I am running 5.6.1 and I looked at the corresponding
Documentation.
> > > And what has this got to do with threads?
> > They have to run at the same time. Starting the 2nd after the 1st
> >has finished would
> > take to much time.
>
> Hmmm... unless the action is quite long, and you were running under
> Unix, I would go for serial anytime. Perl threads are slow starters,
> so in general you wouldn't want to start one for every element.
>
> Are you trying to do reverse DNS lookups?
>
The Final program will do a Ping on a Hostname and if the host is up
I
will write to the Messanger Mailslot.
Doing this serial to > 200 hosts may take up to 20 minutes if a lot
of
hosts is down ( they're Workstations, so it is normal that some of
them
are down ). So I try to do it with threads.
> In any case, this would seem like you could use Thread::Pool for
> this, available from CPAN.
>
>
> > > before the exit and the program should stop without errors.
> > Ups, sorry, I forgot this, but after adding this two lines I still
> >have the same error.
>
> Then I have no idea what is going on. Could you mail the _exact_
> program that you're running that produces the error, along with perl
> -V output?
>
>
> Liz