user450334
user450334

Reputation: 47

How to execute subroutine in parallel?

I want to know how to execute two subroutines in parallel.

In Perl Tk, I am using one buttons widget and text widget.

Button : is to execute the parser function Text : is to display the print statement of the parser

Thing is that after executing the parser function only the text widget is getting executed [because Perl support sequential execution]

But I want both of them to be executed in parallel.

Upvotes: 1

Views: 1510

Answers (1)

DVK
DVK

Reputation: 129383

Implement a fork and have the child process launch the second subroutine and communicate the results to the parent process via interprocess communication (IPC).

You can also try to use threads, though it would not be my recommended solution

P.S. The discussion on this SO question should also prove informative, though is not 100% the duplicate of your need:

How can I signal a forked child to terminate in Perl?

Upvotes: 1

Related Questions