Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- mysql_query("LOCK TABLES flows READ");
- if (!($pid1 = pcntl_fork())) {
- // Child #1
- $result = mysql_query("whatever");
- /* ... do processing ... */
- die();
- }
- if (!($pid2 = pcntl_fork())) {
- // Child #2
- $result = mysql_query("whatever");
- /* ... do processing ... */
- die();
- }
- // Wait for threads to finish
- while (!pcntl_waitpid($pid1, $status, WNOHANG) || !pcntl_waitpid($pid2, $status, WNOHANG)) {
- usleep(100);
- }
- mysql_query("UNLOCK TABLES");
- echo "Done.\n";
Add Comment
Please, Sign In to add comment