PHP Classes
elePHPant
Icontem

File: functions/functions.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Bijaya Kumar Behera  >  Multi-threading in PHP  >  functions/functions.php  >  Download  
File: functions/functions.php
Role: Auxiliary script
Content type: text/plain
Description: user function
Class: Multi-threading in PHP
Run emulated parallel threads with HTTP requests
Author: By
Last change:
Date: 2 years ago
Size: 1,136 bytes
 

Contents

Class file image Download
<?php
   
/**
     * Multi Threading
     * @author Bijaya Kumar
     * @email it.bijaya@gmail.com
     * @mobile +91 9911033016
     * @link http://www.digitalwebsolutions.in
    **/
   
   
   
    /*
        function : doSleep
    */
   
function doSleep ($sleep, $mrs ) {
       
       
// invoke
       
mThread::invoke ('doSleep_showProgress',"Hello <b>$mrs</b> i'm going to sleep for $sleep secs from now " . date('Y-m-d H:i:s') ) ;
       
       
// sleep for $sleep sec
       
sleep( $sleep );
       
       
// invoke
       
mThread::invoke ('doSleep_showProgress',"Hello <b>$mrs</b> i'm sorry for sleeping for $sleep secs now " . date('Y-m-d H:i:s') ) ;
       
       
// return spllep time back
       
mThread::set_args($sleep);
       
    }
   
/*
        function : doSleep1
    */
   
function doSleep1 ($sleep, $mrs ) {
       
doSleep ( $sleep, $mrs ) ;
    }
   
/*
        function : doSleep2
    */
   
function doSleep2 ($sleep, $mrs ) {
       
doSleep ( $sleep, $mrs ) ;
    }
   
/*
        function : doSleep_showProgress_onThreadCallback
    */
   
function doSleep_showProgress_onThreadCallback ($message ) {
        echo
"<br /> Recevive Response [" . date('Y-m-d H:i:s') . "] :";
       
print_r ( $message );
        echo
"<br />";
    }
?>