Hi Dmitry,
On 7.04.2015 16:33, Dmitry Stogov wrote:
Hi Andrey,
I didn't get why do you need this extension and how it's going to be used.
I would like to implement (I have a PoC for this too), asynchronous
query handlers in mysqli@mysqlnd. Currently it is possible to have some
asynchronisity like
$c = mysqli_query("....", MYSQLI_ASYNC);
// do some work
// poll with mysqli_poll
// synchronise with mysqli_reap_async_query
// fetch data
I would like to skip the //poll and in some cases the //synchronise part
and have
$c = mysqli_query("....", MYSQLI_ASYNC,
function () use ($c) {
$res = mysqli_reap_async_query($c);
// do something with the result
}
);
The closure can also set some global flag, and somewhere in the "main"
thread it one can synchronize on it. It can also use [class, method]
callback syntax. For example one can subclass class mysqli, add some
status variables for state, and a method to pass to mysqli_query()/
mysqli::query().
mysqlnd registers a small tick function, that does select, and if there
is data to be read the closure is called. Another closure for handling
an error should be added too (but I don't have it my PoC).
Hope this helps to enlighten my intentions.
Best,
Andrey
Thanks. Dmitry.
On Tue, Apr 7, 2015 at 4:43 PM, Andrey Hristov <p...@hristov.com
<mailto:p...@hristov.com>> wrote:
Hi,
I would like to hear comments about a small change to the low-level
tick functionality (main/php_ticks.c) to add state to when calling a
C tick function
The patch is alive at : http://pastebin.com/0zhVNxaY
Currently a C tick function gets as a parameter just the number of
ticks, and can't preserve state between calls. On PHP level one can
use closures to mitigate this, but in the C world we don't have this
luxury.
Any comments are very welcome. If possible to get in PHP7.
Cheers,
Andrey
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php