Setup pcntl_fork() for multiple include files

  • Status Closed
  • Budget N/A
  • Total Bids 3

Project Description

[url removed, login to view]

threads = 0;

}

// dispatch a new thread

function dispatch($file)

{

$this->threads++;

// start new thread

$pid = pcntl_fork();

if($pid == -1) // fork failed

{

return false;

}

elseif ($pid > 0) // parent

{

return true;

}

else // child

{

// include requested file

include($file);

exit;

}

}

// wait for all threads to finish

function wait(&$status = null)

{

//wait for each thread to finish

for ($i=0; $i threads; $i++)

{

pcntl_wait($status);

}

}

}

?>

dispatch("[url removed, login to view]");

$async->dispatch("[url removed, login to view]");

$async->dispatch("[url removed, login to view]");

$async->wait();

?>

This Code print Results in Page.

But i want all output in $string after closing all functions and classes.

Page : a,b,[url removed, login to view] ( Normal CURL requests.

$markup="something"; echo $markup;

Requirements :

1 : php parallel processing

2 : get all output in string at end of code..

3 : Show output only when we want to use. means ( echo $string; ) .

3 : speed improvements (don't make it heavy code).

Get free quotes for a project like this
Skills Required

Looking to make some money?

  • Set your budget and the timeframe
  • Outline your proposal
  • Get paid for your work

Hire Freelancers who also bid on this project

    • Forbes
    • The New York Times
    • Time
    • Wall Street Journal
    • Times Online