Workerman: run func in new thread

nop1984

问题描述

Workerman - how to process array items in different processes

Hi. Classic usage : Workerman as HTTP servers. It gets with POST request a array of items, where each item is to be processed in near 3 seconds.
Means in Workerman::onMessage() handler I have a loop

foreach($items as $item) {
  doMagicOfProcessing($item);
}

sure that sync process. How can I run the doMagicOfProcessing($item); in individual process, like onMessage() handler does that for incomming requests, with respect to $Workerman->count limit natively to all framework mechanics?

Thank you.
P.S. If that API exists I think that worth including into docs, even on project frontpage in examples section.

1120 0 0
0个回答

年代过于久远,无法发表回答
×
🔝