GoLang pht\Thread::addFileTask

request it (363)
GoLang replacement for PHP's pht\Thread::addFileTask [edit | history]



Do you know a GoLang replacement for PHP's pht\Thread::addFileTask? Write it!

PHP pht\Thread::addFileTask

PHP original manual for pht\Thread::addFileTask [ show | php.net ]

pht\Thread::addFileTask

(PECL pht >= 0.0.1)

pht\Thread::addFileTaskFile threading

Description

public void pht\Thread::addFileTask ( string $fileName [, mixed $...globals ] )

Adds a new file task to a pht\Threads internal task queue.

Parameters

func

The name of the file to be threaded.

...globals

An optional list of arguments for the file. These arguments will be placed into a $_THREAD superglobal, which will be made available inside of the threaded file. All arguments will be serialised (since they are being passed to another thread).

Return Values

No return value.

Examples

Example #1 Adding a new file task to a thread

<?php

use pht\Thread;

$thread = new Thread();

$thread->addFileTask('file.php'123);

$thread->start();
$thread->join();

file.php:

<?php

[$one$two$three] = $_THREAD;

var_dump($one$two$three);

The above example will output:

int(1)
int(2)
int(3)