Added #1196 async function queuing

Type ID: ASYNC_FUNCTION
Params: array("function" => $functionName, "arguments" => array
$argumentArray)
This commit is contained in:
Shoghi Cervantes
2014-02-23 13:39:34 +01:00
parent 13274ebefa
commit 24722e3c9a
2 changed files with 17 additions and 0 deletions

View File

@@ -21,6 +21,7 @@
define("ASYNC_CURL_GET", 1);
define("ASYNC_CURL_POST", 2);
define("ASYNC_FUNCTION", 3);
class StackableArray extends Stackable{
public function __construct(){
@@ -94,6 +95,12 @@ class AsyncMultipleQueue extends Thread{
$this->output .= Utils::writeInt($rID).Utils::writeShort(ASYNC_CURL_POST).Utils::writeInt(strlen($res)).$res;
$this->unlock();
break;
case ASYNC_FUNCTION:
$function = $this->get(Utils::readShort($this->get(2), false));
$params = unserialize($this->get(Utils::readInt($this->get(4))));
$res = serialize(@call_user_func_array($function, $params));
$this->output .= Utils::writeInt($rID).Utils::writeShort(ASYNC_FUNCTION).Utils::writeInt(strlen($res)).$res;
break;
}
}
usleep(10000);