TameJS syntax for Async/Parallel execution in PHP

From: Date: Fri, 05 Aug 2011 01:54:25 +0000
Subject: TameJS syntax for Async/Parallel execution in PHP
Groups: php.internals 
Request: Send a blank email to internals+get-54395@lists.php.net to get a copy of this message
Hello, I came across this little library called TameJS (http://tamejs.org/) and fell in love with the it's syntax. This had me thinking if it was possible to add such features to a PHP CLI (or web app): <?php await { // wait until all calls within this block is mysql_query_async($sql, $args, defer($rs)); // call asynchronous query curl_post_async($url,$data, defer($response)); // make asynchronous http request } $rows = $rs->fetchAll(); // do something here ?> The "await" keyword marks a section of code that depends on externals events, like network or disk activity, or a timer. An await block contains one or more calls to defer. I think the above syntax makes it easier to write asynchronous apps that can take advantage of multiple threads or processors What do you think? __ Raymond

« previous php.internals (#54395) next »