Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7902729
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T09:34:40+00:00 2026-06-03T09:34:40+00:00

I am new to Perl and I am writing a program that requires the

  • 0

I am new to Perl and I am writing a program that requires the use of threading. I have found the threads feature in Perl, but I find that I am still a bit confused. As stated in the title of this post Java is probably the most common to use threads. I am not saying that it is perfect, but I can get the job done using the Thread class.

In Java I have a method called startThreads and in that method I created the threads and then started them. After starting them there is a while loop that is checking if the treads are done. If all the threads have exited properly then the while loop exits, but if not then the while loop is watching what threads have timed out and then safely interrupts those threads and sets their shutdown flags to true.

The problem:
In Perl I want to use the same algorithm that I have stated above, but of course there are differences in Perl and I am new to Perl. Is it possible to have the while loop running while the other threads are running? How is it done?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T09:34:42+00:00Added an answer on June 3, 2026 at 9:34 am

    After reading the link that Michael Slade provided, I found that Cyber-Guard Enterprise was correct. By detaching the thread the main still is performing work. I haven’t tested it out yet, but it looks like $thr->is_running() can tell me if the thread is still running.

    This was taken from the url that was provided and shows how detach is used.
    perldoc.perl.org/perlthrtut.html?

    use threads;
    my $thr = threads->create(\&sub1); # Spawn the thread
    $thr->detach(); # Now we officially don't care any more
    sleep(15); # Let thread run for awhile
    sub sub1 {
    $a = 0;
    while (1) {
    $a++;
    print("\$a is $a\n");
    sleep(1);
    }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am new to Perl and I have a problem that's very simple but
I have a Perl program that has a GTK2 GUI (via the Gtk2 package).
I'm new to Perl and I'm writing a program where I want to force
I'm relatively new to Perl, writing some XML parsing scripts. I have done two
I'm writing a combination Java/Perl program that parses XML files into an Oracle SQL
I am writing a perl program to extract lines that are in between the
I am writing a Perl module Galaxy::SGE::MakeJobSH with OO. I want to use MakeJobSH->new()
What are the concepts that must be known by a new Perl developer for
#!/usr/bin/env perl use warnings; use strict; use Excel::Writer::XLSX; my $workbook = Excel::Writer::XLSX->new( 'perl.xlsx' );
Im new to perl, so sorry if this is obvious, but i looked up

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.