?
Solved

two simultaneous processes in perl

Posted on 2005-04-07
3
Medium Priority
?
149 Views
Last Modified: 2008-03-06
how can i set a timer to run in the background of my program withouth interrupting my main program?
basically i need to execute a function on my time every 5 seconds withouth interrupting the flow of my main program.

i have a menu that reads from the <stdin> and while waiting (or executing other functions) i need to execute the timer on the background.
I think that there should be two processes running at the same time, one for the timer and one for my menu

how can i do this? can i use fork???
0
Comment
Question by:jazz250
2 Comments
 
LVL 18

Accepted Solution

by:
kandura earned 1000 total points
ID: 13730572
Hi jazz250,
> how can i do this? can i use fork???

depends on the version of perl and the OS yoú're going to run this on. If OS eq Windows, then fork() and alarm() are almost completely unsupported. If perl < 5.8, then threads are mostly unreliable.

HTH,
Kandura
0
 
LVL 2

Author Comment

by:jazz250
ID: 13915789
fork finally worked fine for me... had some issues while trying to create more than 64 processes (even if i exit() them)

0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I've just discovered very important differences between Windows an Unix formats in Perl,at least 5.xx.. MOST IMPORTANT: Use Unix file format while saving Your script. otherwise it will have ^M s or smth likely weird in the EOL, Then DO NOT use m…
Email validation in proper way is  very important validation required in any web pages. This code is self explainable except that Regular Expression which I used for pattern matching. I originally published as a thread on my website : http://www…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Six Sigma Control Plans
Suggested Courses

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question