calling several commands at the same time 
Author Message
 calling several commands at the same time

I am trying to do something like this:

&foo;

sub foo {
    somefunction;                 # takes several seconds
    someotherfunction;        # takes several seconds
    yetanotherfunction;        # takes several seconds

Quote:
}

Is there anyway to have all of the functions in foo called at the exact
same time and not wait for the previous one to finish.  One way I have
tried getting around it is using system and forking the process in the
background for each function.  I'm sure there has to be a better way.
Any help will be greatly appreciated.

Thanks.



Sun, 26 Jan 2003 03:00:00 GMT  
 calling several commands at the same time

  SL> sub foo {
  SL>     somefunction;                 # takes several seconds
  SL>     someotherfunction;        # takes several seconds
  SL>     yetanotherfunction;        # takes several seconds
  SL> }

  SL> Is there anyway to have all of the functions in foo called at the exact
  SL> same time and not wait for the previous one to finish.  One way I have
  SL> tried getting around it is using system and forking the process in the
  SL> background for each function.  I'm sure there has to be a better way.
  SL> Any help will be greatly appreciated.

use Parallel::Universe ;

if these are functions in perl, how could you expect them to run
simultaneously without some sort of parallelism like threads or
processes? and don't use threads with perl unless you know what you are
doing.

so if each of those is working hard (or really they are blocking), fork
off children and selecton their output. it is easy with open FH, "foo|"
and IO::Select.

uri

--

SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page  -----------  http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net  ----------  http://www.northernlight.com



Sun, 26 Jan 2003 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Reportsmith

2. calling several commands at the same time

3. How to fork several times

4. Several actions in the same time

5. MakeMaker questions: C++ and generating several files at compile time

6. Sorting files by character columns several times over

7. Using only one ODBC with several cgis, at the same time

8. Using only one ODBC with several cgis, at the same time

9. processing a file several times

10. Advice for Novice to Delphi

11. Help please can someone tell me where i have gone wrong ???

12. Online syntax diagrams. Where?

 

 
Powered by phpBB® Forum Software