downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | conferences | my php.net

search for in the

GearmanException> <GearmanWorker::wait
[edit] Last updated: Thu, 23 May 2013

view this page in

GearmanWorker::work

(PECL gearman >= 0.5.0)

GearmanWorker::workEspera y realiza un trabajo

Descripción

public bool GearmanWorker::work ( void )

Espera a que se asigne un trabajo y llama a la función de retorno apropiada. Envía un E_WARNING con el último error Gearman si el resultado no es GEARMAN_SUCCESS, GEARMAN_IO_WAIT, o GEARMAN_WORK_FAIL.

Parámetros

Esta función no tiene parámetros.

Valores devueltos

Devuelve TRUE en caso de éxito o FALSE en caso de error.

Ejemplos

Ejemplo #1 GearmanWorker::work() example

<?php

# Crea el trabajador
$worker = new GearmanWorker(); 

# Añade el servidor por defecto (localhost)
$worker->addServer(); 

# Añade la función "reverse"
$worker->addFunction("reverse""my_reverse_function"); 

# Inicia el trabajador escuchando trabajos entrantes
while ($worker->work()); 
 
function 
my_reverse_function($job

  return 
strrev($job->workload()); 
}

?>

Ver también



add a note add a note User Contributed Notes GearmanWorker::work - [0 notes]
There are no user contributed notes for this page.

 
show source | credits | sitemap | contact | advertising | mirror sites