• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 282
  • Last Modified:

multithread

How Is it possible to make the cgi environment multithreaded? What kind of changes we need to make.  
0
seethiru
Asked:
seethiru
  • 2
  • 2
1 Solution
 
makerpCommented:
using win32 of unix ????

theres a win32 thread module, in active state this is still beta.  
0
 
seethiruAuthor Commented:
The question is focussed on unix.
0
 
seethiruAuthor Commented:
Adjusted points to 10
0
 
makerpCommented:
right then

two options for creating new proccess.

threads
OR
forking

forking is a bit of a more aggresive answer and takes the follwoing form

if( $pid = fork )
{
     # parent code here
     # proccess id avalibe in $pid
}
elsif
{
     # child here
     # parent processid avalible with
     # getppid()
}
else
{
     die "can fork() :".$!;
}

Threads

these are a more light wait answer but still only beta, well atleast in perl 5.005 and the perl build you have must be built for multi threading. see http://www.perl.com

# you can pass parameters to the function\sub as a second argument to the thread function.

$t = new Thread(mysub);

sub mysub()
{
     print("Heelo from mr thread");
}

this will create a new thread and the threads starting point will be mysub

there are quite a few thread functions for control etc see www.perl.com, you can get the module desciprtion etc....

hope this helps
0

Featured Post

[Webinar] Kill tickets & tabs using PowerShell

Are you tired of cycling through the same browser tabs everyday to close the same repetitive tickets? In this webinar JumpCloud will show how you can leverage RESTful APIs to build your own PowerShell modules to kill tickets & tabs using the PowerShell command Invoke-RestMethod.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now