Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Code below the thread creation not getting executed in windows perl script

by Davewhite (Acolyte)
on Jul 23, 2009 at 12:18 UTC ( [id://782658]=perlquestion: print w/replies, xml ) Need Help??

Davewhite has asked for the wisdom of the Perl Monks concerning the following question:

Hi, From a windows perl script, I am invoking a thread which runs the TERATERM macro utility in newly created thread. Problem is that the perl scrpt code below the thread creation is not getting executed. Creating thread as follows using available perl Thread module: my $ttThreadId = threads->create(\&invokeTeraTerm, <func_arg>); The thread code is working fine. But the code below the thread creation line in main file is not getting executed (Not even the print statement). Any suggestion / alternate opinion is welcomed. Thanks in advance Dave
  • Comment on Code below the thread creation not getting executed in windows perl script

Replies are listed 'Best First'.
Re: Code below the thread creation not getting executed in windows perl script
by SuicideJunkie (Vicar) on Jul 23, 2009 at 14:30 UTC

    Markup in the Monastery
    Code tags and formatting will help make your posts clearer.

    Try stripping the code down to the bare minimum that will still cause the issue, and most of the time the problem will become obvious. And, even when it doesn't, you will have a nice short chunk of code you can post here where the problem should hopefully be obvious to at least one monk in the crowd.

    Debugging without code is like performing surgery while blindfolded. But I will take a stab in the dark, and guess that perhaps you are execing the teraterm app, and thus blowing away your perl interpreter?

Re: Code below the thread creation not getting executed in windows perl script
by ramlight (Friar) on Jul 23, 2009 at 17:54 UTC
    The first thing to do is make sure that your version of Perl was compiled with thread support.

    The output from perl -V on my system includes the following lines:

    C:\pwe>perl -V Summary of my perl5 (revision 5 version 10 subversion 0) configuration +: Platform: osname=MSWin32, osvers=5.2, archname=MSWin32-x64-multi-thread uname='' config_args='undef' hint=recommended, useposix=true, d_sigaction=undef useithreads=define, usemultiplicity=define useperlio=define, d_sfio=undef, uselargefiles=define,
    and also:
    Characteristics of this binary (from libperl): Compile-time options: MULTIPLICITY PERL_DONT_CREATE_GVSV PERL_IMPLICIT_CONTEXT PERL_IMPLICIT_SYS PERL_MALLOC_WRAP PL_OP_SLAB_ALLOC USE_64_BIT_I +NT USE_ITHREADS USE_LARGE_FILES USE_PERLIO USE_SITECUSTOMIZE
    Once you are satisfied that your Perl supports threads, you might want to compare your code with this snippet from one of my programs (which happily uses quite a few threads) and see if comparing it with your code might help.
    foreach my $seq (0..$number-1) { my $doneflag = \$play_done[$seq]; $$doneflag = 0; $play_list[$seq] = threads->create(\&PlayoutThread, $doneflag, $target_list[$seq], $media_type, $portnum, $playouts); # Mark as already done if thread creation failed unless ($play_list[$seq]) { $$doneflag = 2; $play_errors++; } # Count it if thread creation succeeded else { $started++; } }
Re: Code below the thread creation not getting executed in windows perl script
by mzedeler (Pilgrim) on Jul 23, 2009 at 16:12 UTC

    Are you sure that threads work in the environment you are using? Try writing a small test to ensure that its working.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://782658]
Approved by ww
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (4)
As of 2024-04-23 23:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found